@Override public boolean isConnected() { if (callbackClient == null) { return false; } return callbackClient.isConnected(); }
public boolean isConnected() { Client client = m_client.get(); return (client != null) && client.isConnected(); }
public boolean isConnected() { Client client = m_client.get(); return (client != null) && client.isConnected(); }
/** * Will disconnect loader client if is present. */ public void destroy() { if(loaderClient != null && loaderClient.isConnected()) { loaderClient.disconnect(); } }
public void connect() throws Exception { if (callBackClient != null) { if (callBackClient.isConnected()) return; callBackClient.connect(); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view=convertView; if (convertView==null) { view=inflater.inflate(R.layout.activeclientlist,null); } TextView ip=(TextView)view.findViewById(R.id.clientip); ImageView status = (ImageView )view.findViewById(R.id.status); Client c = getItem(position); ip.setText(c.getIpAddress()); status.setImageDrawable(c.isConnected() ? R.drawable.ic_status_connected : 0); return view; }
/** * The socket factory can only be set on the Client before the connect() method has been called. * Otherwise, a runtime exception will be thrown. */ public void setSocketFactory(SocketFactory socketFactory) { if(isConnected()) { throw new RuntimeException("Cannot set socket factory on Client after " + "the connect() method has been called."); } if (invoker != null) { invoker.setSocketFactory(socketFactory); } else { this.socketFactory = socketFactory; } }
public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(Version.getDefaultVersion()); out.writeObject(invoker != null ? invoker.getLocator() : locator); out.writeObject(subsystem); out.writeObject(configuration); out.writeBoolean(isConnected()); out.flush(); }
/** * Sets the unmarshaller implementation that should be used by the client invoker (transport). * This overrides the client's default unmarshaller (or any set within configuration). */ public void setUnMarshaller(UnMarshaller unmarshaller) { if (isConnected()) { if (unmarshaller != null) { invoker.setUnMarshaller(unmarshaller); } else { throw new NullPointerException("Can not set UnMarshaller to null value."); } } else { throw new RuntimeException("Can not set remoting client UnMarhshaller when not connected."); } }
/** * Sets the marshaller implementation that should be used by the client invoker (transport). This * overrides the client's default marshaller (or any set within configuration). */ public void setMarshaller(Marshaller marshaller) { if (isConnected()) { if (marshaller != null) { invoker.setMarshaller(marshaller); } else { throw new NullPointerException("Can not set Marshaller with a null value."); } } else { throw new RuntimeException("Can not set remoting client Marshaller when not connected."); } }
private Object invoke(Object param, Map metadata, InvokerLocator callbackServerLocator) throws Throwable { if (isConnected()) { return invoker.invoke(new InvocationRequest(sessionId, subsystem, param, metadata, null, callbackServerLocator)); } else { throw new Exception("Can not make remoting client invocation " + "due to not being connected to server."); } }
/** * Will cause the underlying transport to make connection to the target server. This is * important for any stateful transports, like socket or multiplex. This is also when a client * lease with the server is started. */ public void connect() throws Exception { if (isConnected()) return; if (locator == null) { throw new IllegalStateException("Cannot connect a client with a null locator"); } if (invoker == null) { if (socketFactory != null) { configuration.put(Remoting.CUSTOM_SOCKET_FACTORY, socketFactory); this.socketFactory = null; } invoker = InvokerRegistry.createClientInvoker(locator, configuration); } connect(invoker); connected = true; }
if(!loaderClient.isConnected())
if(client.isConnected() && ClientListener.hasListeners())
/** * Invokes JBoss Remoting using the given command. * Attempts to cache the client if sending the message was successful. * * @return object as a result of this call */ private Object invoke(Command command) throws Throwable { InvokerLocator locator = m_invokerLocator; if (locator == null) { throw new IllegalStateException("m_invokerLocator is null"); } Client client = m_client.get(); if (client != null && client.getInvoker() == null) { client.disconnect(); } if (client == null || !client.isConnected()) { client = new Client(locator, getSubsystem(), m_clientConfiguration); client.connect(); try { return client.invoke(command); } finally { cacheClient(client); } } // Note: Despite all the checks above, the client might have been // disconnected before invoke is reached. Let's hope that doesn't happen. return client.invoke(command); }
/** * Invokes JBoss Remoting using the given command. * Attempts to cache the client if sending the message was successful. * * @return object as a result of this call */ private Object invoke(Command command) throws Throwable { InvokerLocator locator = m_invokerLocator; if (locator == null) { throw new IllegalStateException("m_invokerLocator is null"); } Client client = m_client.get(); if (client != null && client.getInvoker() == null) { client.disconnect(); } if (client == null || !client.isConnected()) { client = new Client(locator, getSubsystem(), m_clientConfiguration); client.connect(); try { return client.invoke(command); } finally { cacheClient(client); } } // Note: Despite all the checks above, the client might have been // disconnected before invoke is reached. Let's hope that doesn't happen. return client.invoke(command); }