private static ServerAPI getServerAPI() { return ServerAPIFactory.getServerAPI(false); }
public static ServerAPI getServerAPI(final boolean cleanSession) { return ServerAPIFactory.getInstance().getServerAPIImplementation(cleanSession); }
private ServerAPI getServerAPIImplementation(final boolean cleanSession) { Class<?> serverApiClass = getServerAPIClass(); try { return (ServerAPI) serverApiClass.getConstructor(boolean.class).newInstance(cleanSession); } catch (Exception e) { throw new ExceptionInInitializerError(String.format(SERVER_API_CLASS_NOT_FOUND, serverApiClass.getName())); } }
ServerAPI getServerAPIImplementation() { Class<?> aClass = getServerAPIClass(); try { return (ServerAPI) aClass.newInstance(); } catch (Exception e) { throw new ExceptionInInitializerError(String.format(SERVER_API_CLASS_NOT_FOUND, aClass.getName())); } }
ServerAPI getServerAPI() { return ServerAPIFactory.getServerAPI(); }
public static ServerAPI getServerAPI(final boolean cleanSession) { return ServerAPIFactory.getInstance().getServerAPIImplementation(cleanSession); }
ServerAPI getServerAPIImplementation() { Class<?> aClass = getServerAPIClass(); try { return (ServerAPI) aClass.newInstance(); } catch (Exception e) { throw new ExceptionInInitializerError(String.format(SERVER_API_CLASS_NOT_FOUND, aClass.getName())); } }
private static ServerAPI getServerAPI() { return ServerAPIFactory.getServerAPI(false); }
public static ServerAPI getServerAPI() { return ServerAPIFactory.getInstance().getServerAPIImplementation(); }
private ServerAPI getServerAPIImplementation(final boolean cleanSession) { Class<?> serverApiClass = getServerAPIClass(); try { return (ServerAPI) serverApiClass.getConstructor(boolean.class).newInstance(cleanSession); } catch (Exception e) { throw new ExceptionInInitializerError(String.format(SERVER_API_CLASS_NOT_FOUND, serverApiClass.getName())); } }
ServerAPI getServerAPI() { return ServerAPIFactory.getServerAPI(); }
public static ServerAPI getServerAPI() { return ServerAPIFactory.getInstance().getServerAPIImplementation(); }
public TcpServer(final List<Integer> ports) throws InterruptedException, IOException { final int nbOfPorts = ports.size(); int i = 1; final ServerAPI apiImpl = ServerAPIFactory.getServerAPI(); for (final int port : ports) { final String threadName = ServerSocketThread.class.getSimpleName() + "-" + String.format("%" + nbOfPorts + "d", i) + "-p" + port; sockets.add(new ServerSocketThread(threadName, apiImpl, port)); i++; } for (final ServerSocketThread socket : sockets) { socket.start(); } for (final ServerSocketThread socket : sockets) { socket.join(); } }
@Override public Object invokeMethod(final Map<String, Serializable> options, final String apiInterfaceName, final String methodName, final List<String> classNameParameters, final Object[] parametersValues) throws ServerWrappedException, RemoteException { final ServerAPI apiImpl = ServerAPIFactory.getServerAPI(); try { return apiImpl.invokeMethod(options, apiInterfaceName, methodName, classNameParameters, parametersValues); } catch (final ServerWrappedException e) { // merge stack trace of the server exception throw StackTraceTransformer.mergeStackTraces(e); } }