Package host.anzo.simon
Class InterfaceLookup
java.lang.Object
host.anzo.simon.InterfaceLookup
- All Implemented Interfaces:
Lookup
With this class, you can make a lookup by providing a Interface.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInterfaceLookup(String host, int port) protectedInterfaceLookup(InetAddress serverAddress, int serverPort) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClosedListener(Object remoteObject, ClosedListener closedListener) Attaches a closed listener to the specified remote objectvoidawaitCompleteShutdown(long timeout) Awaits a complete network shutdown.getClosedListeners(Object remoteObject) Returns a list of attachedClosedListeners.intTries to lookup a remote object on the server.booleanReleases are remote object.protected static booleanreleaseDispatcher(Dispatcher dispatcher) Releases aDispatcher.booleanremoveClosedListener(Object remoteObject, ClosedListener closedListener) Removes an already attached closed listener from the specified remote objectvoidsetClassLoader(ClassLoader classLoader) voidsetProxyConfig(SimonProxyConfig proxyConfig) voidsetSourceAddress(InetAddress sourceAddress) Sets the address that is used as the source address for the lookup-request.voidsetSslContextFactory(SslContextFactory sslContextFactory)
-
Field Details
-
sourceAddress
-
-
Constructor Details
-
InterfaceLookup
- Throws:
UnknownHostException
-
InterfaceLookup
-
-
Method Details
-
getSslContextFactory
-
setSslContextFactory
-
getProxyConfig
-
setProxyConfig
-
getClassLoader
-
setClassLoader
-
getServerAddress
-
getServerPort
public int getServerPort() -
lookup
public Object lookup(String canonicalInterfaceName) throws LookupFailedException, EstablishConnectionFailed Description copied from interface:LookupTries to lookup a remote object on the server. A successful lookup includes:- established socket connection to server, if not already connected
- increased reference counter for this client-to-server connection by 1
- return of the requested remote object
Lookup.release(Object).- Returns:
- the remote object
- Throws:
LookupFailedExceptionEstablishConnectionFailed
-
setSourceAddress
Description copied from interface:LookupSets the address that is used as the source address for the lookup-request. This might be useful if client machine has more than one network interface or server requires a specific client subnet- Specified by:
setSourceAddressin interfaceLookup
-
release
Description copied from interface:LookupReleases are remote object. Releasing a remote objects leads to:- release of related SIMON resources (threads, ...)
- decrease reference counter for this client-to-server connection by 1
- if reference counter reaches 0, the client-to-server connection will be disconnected and cleaned up
-
getClosedListeners
Description copied from interface:LookupReturns a list of attachedClosedListeners.- Specified by:
getClosedListenersin interfaceLookup- Parameters:
remoteObject- the remote object to query for attached closed listeners- Returns:
- a list of attached closed listeners
-
addClosedListener
Description copied from interface:LookupAttaches a closed listener to the specified remote object- Specified by:
addClosedListenerin interfaceLookup- Parameters:
remoteObject- the remote object to which the listener is attached toclosedListener- the listener to add
-
removeClosedListener
Description copied from interface:LookupRemoves an already attached closed listener from the specified remote object- Specified by:
removeClosedListenerin interfaceLookup- Parameters:
remoteObject- the remote object from which the listener has to be removedclosedListener- the listener to remove- Returns:
- true, if listener was removed, false if there is no listener to remove
-
awaitCompleteShutdown
public void awaitCompleteShutdown(long timeout) Awaits a complete network shutdown. Means: Waits until all network connections are closed or timeout occurs.- Parameters:
timeout- timeout for awaiting complete network shutdown- Since:
- 1.2.0
-
releaseDispatcher
Releases aDispatcher. If there is no more server string referencing the Dispatcher, the Dispatcher will be released/shutdown.- Parameters:
dispatcher- the iDispatcher to release- Returns:
- true if the Dispatcher is shut down, false if there's still a reference pending
-