/** * Returns the locator to the connector. Locator is the actual InvokerLocator * object used to identify and get the ServerInvoker we are wrapping. * * @jmx.managed-attribute description = "Locator is the actual InvokerLocator object used to * identify and get the ServerInvoker we are wrapping." * access = "read-only" */ public InvokerLocator getLocator() { return invoker.getLocator(); }
/** * Adds a connection listener to receive notification when a client connection * is lost or disconnected. Will only be triggered for notifications when * leasing is turned on (via the lease period attribute being set to > 0). * * @param listener * @jmx.managed-operation description = "Add a connection listener to call when detect that a client has * failed or disconnected." * impact = "ACTION" * @jmx.managed-parameter name = "listener" * type = "org.jboss.remoting.ConnectionListener" * description = "The connection listener to register" */ public void addConnectionListener(ConnectionListener listener) { if (invoker != null) { invoker.addConnectionListener(listener); } }
/** * Will get the data type for the marshaller factory so know which marshaller to get to marshal * the data. Will first check the locator uri for a 'datatype' parameter and take that value if * it exists. Otherwise, will use the default datatype for the client invoker, based on * transport. */ public String getDataType() { if(dataType == null) { dataType = getDataType(getLocator()); if(dataType == null) { dataType = getDefaultDataType(); } } return dataType; }
invoker.setMBeanServer(server); invoker.setServerSocketFactory(svrSocketFactory); invoker.setSocketFactory(socketFactory); this.socketFactory = null; invoker.create(); ObjectName objName = new ObjectName(invoker.getMBeanObjectName()); if (!server.isRegistered(objName)) locatorURI = invoker.getLocator().getLocatorURI(); marshallerLoaderConnector = createMarshallerLoader(invoker.getLocator());
if(serverInvoker != null) locator = serverInvoker.getLocator(); if(!serverInvoker.isStarted()) serverInvoker.start();
if (isStarted()) boolean response = checkForClientLease(invokerSessionId); if (trace) log.trace(this + " responding " + response + " to $PING$ for invoker sessionId " + invokerSessionId); return new Boolean(response); updateClientLease(invocation); terminateLease(invocation); handleOnewayInvocation((OnewayInvocation)param, invocation); result = handleInternalInvocation((InternalInvocation)param, invocation, handler);
for(int c = 0; c < invokers.length; c++) if(invokers[c].isStarted()) ServerInvokerMetadata serverInvoker = new ServerInvokerMetadata(invokers[c].getLocator(), invokers[c].getSupportedSubsystems()); l.add(serverInvoker);
ret = serverInvoker.invoke(localInvocation); InvokerLocator svrlocator = svrinvoker.getLocator(); if(getLocator().equals(svrlocator)) ret = serverInvoker.invoke(localInvocation);
connectHomes.addAll((Collection) o); else if (o instanceof String) connectHomes.addAll(createHomeCollection((String) o)); else log.warn(this + ": " + InvokerLocator.CONNECT_HOMES_KEY + " must be a collection or String: " + o); homes.addAll((Collection) o); else if (o instanceof String) homes.addAll(createHomeCollection((String) o)); else log.warn(this + ": " + InvokerLocator.HOMES_KEY + " must be a collection or String: " + o); connectHomes.addAll(homes); assignPorts(); return; if(port <= 0) port = assignPort(); if(serverBindPort <= 0) serverBindPort = assignPort();
public void start() throws IOException { super.start(); if (isPrimaryServer) { List connectHomes = getConnectHomes(); List homes = getHomes(); if (connectHomes.size() != homes.size()) throw new IOException("number of connect homes and bind homes must match in RMI transport"); Home bindHome = (Home) homes.get(0); Home connectHome = (Home) connectHomes.get(0); initRMI(bindHome, connectHome); for (int i = 1; i < homes.size(); i++) { bindHome = (Home) homes.get(i); connectHome = (Home) connectHomes.get(i); RMIServerInvoker copy = copy(); secondaryServers.add(copy); copy.initRMI(bindHome, connectHome); } } }
/** * Adds an invocation handler for the named subsystem to the invoker we * manage, and sets the mbean server on the invocation handler. * * @return Previous ServerInvocatioHandler with the same subsystem value (case insensitive) or null if one did not previously exist. * @jmx.managed-operation description = "Add a subsystem invocation handler to the ServerInvoker * we wrap, identified by the subsystem parameter." * impact = "ACTION" * @jmx.managed-parameter name = "subsystem" * type = "java.lang.String" * description = "The subsystem this handler is for." * @jmx.managed-parameter name = "handler" * type = "org.jboss.remoting.ServerInvocationHandler" * description = "The ServerInvocationHandler we are registering * for the subsystem" */ public ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler handler) throws Exception { if (invoker == null) { throw new IllegalStateException("You may only add handlers once the Connector is created (via create() method)."); } handler.setMBeanServer(server); return invoker.addInvocationHandler(subsystem, handler); }
Object result = invoke(request); "Must not be null and must be of type InvocationRequest."); Exception e = new Exception("Error processing invocation request on " + getLocator() + ". Either invocation was null or of wrong type.");
/** * Subclasses should override to provide any specific start logic. */ public void start() throws IOException { started = true; log.debug(this + " started for locator " + getLocator()); }
public static void destroyServerInvoker(ServerInvoker invoker) { if(invoker != null) { InvokerLocator locator = invoker.getLocator(); unregisterLocator(locator); } }
public java.io.Serializable getStub() { return getInvoker().getLocator(); }
/** * Gets the invoker locator string for this server * * @return */ public String getInvokerLocator() { if(serverInvoker != null) { return serverInvoker.getLocator().getLocatorURI(); } else { return null; } }
protected Invoker createProxy(boolean isStrictRMIException, List<?> targets, LoadBalancePolicy policy, String proxyFamilyName, long viewId) { return new UnifiedInvokerHAProxy(getInvoker().getLocator(), isStrictRMIException, targets, policy, proxyFamilyName, viewId); } }
private ServerInvokerCallbackHandler getCallbackHandler(InvocationRequest invocation) throws Exception { ServerInvokerCallbackHandler callbackHandler = null; String id = ServerInvokerCallbackHandler.getId(invocation); synchronized(callbackHandlers) { callbackHandler = (ServerInvokerCallbackHandler)callbackHandlers.get(id); // if does not exist, create it if(callbackHandler == null) { callbackHandler = new ServerInvokerCallbackHandler(invocation, getLocator(), this); callbackHandlers.put(id, callbackHandler); } } callbackHandler.connect(); if(trace) { log.trace("ServerInvoker (" + this + ") adding server callback handler " + callbackHandler + " with id of " + id + "."); } return callbackHandler; }