|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.protocol.AbstractChannel
public abstract class AbstractChannel
Nested Class Summary | |
---|---|
protected class |
AbstractChannel.AsyncErrorNotifier
|
Field Summary |
---|
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
DEFAULT_TIMEOUT, INFINITE_TIMEOUT |
Constructor Summary | |
---|---|
protected |
AbstractChannel(long timeout,
Endpoint endpoint)
|
Method Summary | ||
---|---|---|
void |
addChannelListener(ChannelListener listener)
Adds listener about connection lifecycle events. |
|
protected abstract void |
applyConfiguration()
|
|
void |
configure(ConnectionConfiguration config)
Deprecated. |
|
ConnectionContext<? extends ServerContext> |
connectionContext()
|
|
protected void |
copyTLSSettings(Endpoint endpoint)
Copies TLS parameters to channel context Reason: underlying connection has access to the context, but not endpoint. |
|
protected ChannelClosedEvent |
createChannelClosedEvent(ChannelState prevState,
java.lang.Throwable cause)
|
|
protected void |
fireClosed(java.lang.Throwable reason,
ChannelState prevState)
|
|
protected void |
fireErrorEvent(ChannelErrorEvent event)
|
|
protected void |
fireErrorEvent(java.lang.Throwable exception)
|
|
static int |
generateChannelId()
|
|
int |
getChannelId()
Returns unique identification number of the channel instance. |
|
ConnectionConfiguration |
getConfiguration()
Deprecated. |
|
protected AsyncInvoker |
getDefaultInvoker()
|
|
Endpoint |
getEndpoint()
|
|
protected java.lang.String |
getEnpointPrefixInfo()
|
|
protected AsyncInvoker |
getInvoker()
|
|
protected ListenerHelper |
getListenerHelper()
|
|
protected java.lang.String |
getLocalEndpointInfo(Endpoint endpoint)
|
|
ServerContext |
getServerContext()
|
|
ChannelState |
getState()
Returns channel state. |
|
int |
getStateMods()
|
|
long |
getTimeout()
Returns default timeout for synchronous operations on channel. |
|
protected
|
internal(java.lang.Object internal)
For internal use only. |
|
protected void |
onFireClosed(ChannelClosedEvent event)
|
|
protected void |
onFireErrorEvent(ChannelErrorEvent event)
|
|
protected void |
onFireOpened(java.util.EventObject event)
|
|
protected void |
onSetEndpoint(Endpoint endpoint)
This method is notified before setting a endpoint to the channel. |
|
protected void |
releaseDefaultInvoker()
|
|
void |
removeChannelListener(ChannelListener listener)
Removes listener about connection lifecycle events. |
|
protected void |
setConfiguration(ConnectionConfiguration config)
|
|
void |
setConnectionInvoker(AsyncInvoker connectionInvoker)
Deprecated. |
|
void |
setEndpoint(Endpoint endpoint)
Sets channel endpoint. |
|
void |
setInvoker(AsyncInvoker invoker)
Invoker is used for calling user's code when various protocol events occur (open, close, error, etc). |
|
protected void |
setServerContext(ServerContext serverContext)
|
|
protected void |
setState(ChannelState state)
|
|
protected void |
setState(ChannelState newState,
ConnectionClosedEvent closedEvent)
|
|
void |
setTimeout(long timeout)
Sets default timeout for synchronous operations on channel. |
|
protected void |
throwNotClosed()
|
|
protected void |
throwNotOpened()
|
|
protected void |
throwNotOpenedOnClose()
|
|
protected void |
throwNotOpenedOnSend()
|
|
protected void |
throwNull(java.lang.Object o,
java.lang.String name)
|
|
protected void |
throwNullEndpoint()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
close, close, open, open |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel |
---|
beginClose, beginOpen |
Constructor Detail |
---|
protected AbstractChannel(long timeout, Endpoint endpoint)
Method Detail |
---|
protected java.lang.String getEnpointPrefixInfo()
protected java.lang.String getLocalEndpointInfo(Endpoint endpoint)
public int getChannelId()
public int getStateMods()
public ChannelState getState()
AsyncChannel
getState
in interface AsyncChannel
public ConnectionContext<? extends ServerContext> connectionContext()
public ServerContext getServerContext()
public void setTimeout(long timeout)
setTimeout
in interface Channel
timeout
- timeout in millisecondspublic long getTimeout()
getTimeout
in interface Channel
public void addChannelListener(ChannelListener listener)
ChannelListenerSupport
addChannelListener
in interface ChannelListenerSupport
listener
- listenerpublic void removeChannelListener(ChannelListener listener)
ChannelListenerSupport
removeChannelListener
in interface ChannelListenerSupport
listener
- listenerpublic void setInvoker(AsyncInvoker invoker)
setInvoker
in interface AsyncInvokerSupport
invoker
- Invoker to use@Deprecated public void setConnectionInvoker(AsyncInvoker connectionInvoker)
setConnectionInvoker
in interface ConnectionInvokerSupport
connectionInvoker
- invoker for connection layer@Deprecated public ConnectionConfiguration getConfiguration()
getConfiguration
in interface ConfigurationSupport
getEndpoint()
,
Endpoint.getConfiguration()
@Deprecated public void configure(ConnectionConfiguration config)
ConnectionConfiguration config = protocol.getEndpoint().getConfiguration();
config.setOption(AddpInterceptor.PROTOCOL_NAME_KEY, AddpInterceptor.NAME);
config.setOption(AddpInterceptor.TIMEOUT_KEY, "10");
config.setOption(AddpInterceptor.REMOTE_TIMEOUT_KEY, "11");
config.setOption(AddpInterceptor.TRACE_KEY, "full");
Handler OnChange = new Handler() {
public void onPropertyChanged(Object sender, ChangeEvent event) {
System.out.println(String.format("%1$s >> %2$s -> %3$s", event.getKey(), event.getOldValue(), event.getNewValue()));
}
};
ManagedConfiguration config = (ManagedConfiguration)protocol.getEndpoint().getConfiguration();
config.addAfterPropertyChangeHandler(AddpInterceptor.TIMEOUT_KEY, OnChange);
configure
in interface ConfigurationSupport
Endpoint
,
Endpoint(String, String, int, ConnectionConfiguration)
,
setEndpoint(Endpoint)
public Endpoint getEndpoint()
getEndpoint
in interface EndpointSupport
protected void onSetEndpoint(Endpoint endpoint)
endpoint
- new endpointpublic void setEndpoint(Endpoint endpoint)
setEndpoint
in interface EndpointSupport
endpoint
- endpoint
ChannelNotClosedException
- when channel isn't closedprotected void copyTLSSettings(Endpoint endpoint)
endpoint
- Endpoint instance to copy fromprotected void setState(ChannelState state)
protected void setState(ChannelState newState, ConnectionClosedEvent closedEvent)
protected ChannelClosedEvent createChannelClosedEvent(ChannelState prevState, java.lang.Throwable cause)
protected final void setServerContext(ServerContext serverContext)
public static int generateChannelId()
protected void throwNull(java.lang.Object o, java.lang.String name)
protected void throwNullEndpoint()
protected void throwNotOpenedOnSend() throws ChannelClosedOnSendException
ChannelClosedOnSendException
protected void throwNotClosed() throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected void throwNotOpened() throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected void throwNotOpenedOnClose() throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected void fireClosed(java.lang.Throwable reason, ChannelState prevState)
protected void onFireOpened(java.util.EventObject event)
protected void onFireClosed(ChannelClosedEvent event)
protected void onFireErrorEvent(ChannelErrorEvent event)
protected ListenerHelper getListenerHelper()
protected abstract void applyConfiguration()
protected AsyncInvoker getInvoker()
protected AsyncInvoker getDefaultInvoker()
protected void releaseDefaultInvoker()
protected void setConfiguration(ConnectionConfiguration config)
protected void fireErrorEvent(java.lang.Throwable exception)
protected void fireErrorEvent(ChannelErrorEvent event)
protected final <T> T internal(java.lang.Object internal)
java.lang.RuntimeException
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |