OpenSplice Java FACE API  v6.x
OpenSplice Future Airborne Capability Environment (FACE) Java API
TSFactory.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.vortex.FACE;
21 
22 import java.util.HashMap;
23 import java.util.Map;
24 
25 import FACE.RETURN_CODE_TYPE;
26 import FACE.RETURN_CODE_TYPEHolder;
27 
28 public class TSFactory {
29  private Map<String, TransportServices> tsses;
30  private TSFactory() {
31  this.tsses = new HashMap<String, TransportServices>();
32  }
33 
34  private static class LazyHolder {
35  private static final TSFactory INSTANCE = new TSFactory();
36  }
37 
38  public static TSFactory getInstance() {
39  return LazyHolder.INSTANCE;
40  }
41 
42  public void getTS(String configuration, Holder<TransportServices> tsHolder,
43  RETURN_CODE_TYPEHolder holder) {
44  synchronized(this.tsses){
45  TransportServices ts = this.tsses.get(configuration);
46 
47  if (ts == null) {
48  ts = new TransportServices();
49  ts.Initialize(configuration, holder);
50 
51  if (holder.value == RETURN_CODE_TYPE.NO_ERROR) {
52  this.tsses.put(configuration, ts);
53  tsHolder.value = ts;
54  }
55  } else {
56  tsHolder.value = ts;
57  holder.value = RETURN_CODE_TYPE.NO_ACTION;
58  }
59  }
60  }
61 }
static TSFactory getInstance()
Definition: TSFactory.java:38
void getTS(String configuration, Holder< TransportServices > tsHolder, RETURN_CODE_TYPEHolder holder)
Definition: TSFactory.java:42
void Initialize(String configuration, RETURN_CODE_TYPEHolder return_code)
This is a typed class which will be generated by idlpp.
Definition: TS.java:25