Package org.apache.activemq.transport.vm
Class VMTransport
- java.lang.Object
-
- org.apache.activemq.transport.vm.VMTransport
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanasyncprotected intasyncQueueDepthprotected AtomicBooleandisposedprotected longidprotected URIlocationprotected static org.slf4j.LoggerLOGprotected booleanmarshalprotected VMTransportpeerprotected AtomicBooleanstartedprotected TransportListenertransportListener
-
Constructor Summary
Constructors Constructor Description VMTransport(URI location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FutureResponseasyncRequest(Object command, ResponseCallback responseCallback)An asynchronous request response where the Receipt will be returned in the future.voiddispatch(VMTransport transport, BlockingQueue<Object> pending, Object command)voiddoDispatch(VMTransport transport, TransportListener transportListener, Object command)intgetAsyncQueueDepth()LinkedBlockingQueue<Object>getMessageQueue()X509Certificate[]getPeerCertificates()intgetReceiveCounter()Returns a counter which gets incremented as data is read from the transport.StringgetRemoteAddress()protected TaskRunnergetTaskRunner()TransportListenergetTransportListener()Returns the current transport listenerWireFormatgetWireFormat()Retrieves the WireFormat instance associated with this Transport instance.booleanisAsync()booleanisConnected()booleanisDisposed()booleanisFaultTolerant()Indicates if the transport can handle faultsbooleanisMarshal()booleanisReconnectSupported()booleanisUpdateURIsSupported()booleaniterate()<T> Tnarrow(Class<T> target)voidoneway(Object command)A one way asynchronous sendvoidreconnect(URI uri)reconnect to another locationObjectrequest(Object command)A synchronous request responseObjectrequest(Object command, int timeout)A synchronous request responsevoidsetAsync(boolean async)voidsetAsyncQueueDepth(int asyncQueueDepth)voidsetMarshal(boolean marshal)voidsetPeer(VMTransport peer)voidsetPeerCertificates(X509Certificate[] certificates)Sets the certificates provided by the connected peer.voidsetTransportListener(TransportListener commandListener)Registers an inbound command listenervoidstart()voidstop()StringtoString()voidupdateURIs(boolean reblance, URI[] uris)Provide a list of available alternative locationsprotected voidwakeup()
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
peer
protected VMTransport peer
-
transportListener
protected TransportListener transportListener
-
marshal
protected boolean marshal
-
async
protected boolean async
-
asyncQueueDepth
protected int asyncQueueDepth
-
location
protected final URI location
-
id
protected final long id
-
started
protected final AtomicBoolean started
-
disposed
protected final AtomicBoolean disposed
-
-
Constructor Detail
-
VMTransport
public VMTransport(URI location)
-
-
Method Detail
-
setPeer
public void setPeer(VMTransport peer)
-
oneway
public void oneway(Object command) throws IOException
Description copied from interface:TransportA one way asynchronous send- Specified by:
onewayin interfaceTransport- Throws:
IOException
-
dispatch
public void dispatch(VMTransport transport, BlockingQueue<Object> pending, Object command)
-
doDispatch
public void doDispatch(VMTransport transport, TransportListener transportListener, Object command)
-
start
public void start() throws Exception
-
wakeup
protected void wakeup()
-
iterate
public boolean iterate()
- Specified by:
iteratein interfaceTask- See Also:
Task.iterate()
-
setTransportListener
public void setTransportListener(TransportListener commandListener)
Description copied from interface:TransportRegisters an inbound command listener- Specified by:
setTransportListenerin interfaceTransport
-
getMessageQueue
public LinkedBlockingQueue<Object> getMessageQueue() throws TransportDisposedIOException
- Throws:
TransportDisposedIOException
-
getTaskRunner
protected TaskRunner getTaskRunner() throws TransportDisposedIOException
- Throws:
TransportDisposedIOException
-
asyncRequest
public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException
Description copied from interface:TransportAn asynchronous request response where the Receipt will be returned in the future. If responseCallback is not null, then it will be called when the response has been completed.- Specified by:
asyncRequestin interfaceTransportresponseCallback- TODO- Returns:
- the FutureResponse
- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Returns:
- the response
- Throws:
IOException
-
request
public Object request(Object command, int timeout) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Returns:
- the repsonse or null if timeout
- Throws:
IOException
-
getTransportListener
public TransportListener getTransportListener()
Description copied from interface:TransportReturns the current transport listener- Specified by:
getTransportListenerin interfaceTransport- Returns:
-
narrow
public <T> T narrow(Class<T> target)
-
isMarshal
public boolean isMarshal()
-
setMarshal
public void setMarshal(boolean marshal)
-
getRemoteAddress
public String getRemoteAddress()
- Specified by:
getRemoteAddressin interfaceTransport- Returns:
- the remote address for this connection
-
isAsync
public boolean isAsync()
- Returns:
- the async
-
setAsync
public void setAsync(boolean async)
- Parameters:
async- the async to set
-
getAsyncQueueDepth
public int getAsyncQueueDepth()
- Returns:
- the asyncQueueDepth
-
setAsyncQueueDepth
public void setAsyncQueueDepth(int asyncQueueDepth)
- Parameters:
asyncQueueDepth- the asyncQueueDepth to set
-
isFaultTolerant
public boolean isFaultTolerant()
Description copied from interface:TransportIndicates if the transport can handle faults- Specified by:
isFaultTolerantin interfaceTransport- Returns:
- true if fault tolerant
-
isDisposed
public boolean isDisposed()
- Specified by:
isDisposedin interfaceTransport- Returns:
- true if the transport is disposed
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceTransport- Returns:
- true if the transport is connected
-
reconnect
public void reconnect(URI uri) throws IOException
Description copied from interface:Transportreconnect to another location- Specified by:
reconnectin interfaceTransport- Throws:
IOException- on failure of if not supported
-
isReconnectSupported
public boolean isReconnectSupported()
- Specified by:
isReconnectSupportedin interfaceTransport- Returns:
- true if reconnect is supported
-
isUpdateURIsSupported
public boolean isUpdateURIsSupported()
- Specified by:
isUpdateURIsSupportedin interfaceTransport- Returns:
- true if updating uris is supported
-
updateURIs
public void updateURIs(boolean reblance, URI[] uris) throws IOExceptionDescription copied from interface:TransportProvide a list of available alternative locations- Specified by:
updateURIsin interfaceTransport- Throws:
IOException
-
getReceiveCounter
public int getReceiveCounter()
Description copied from interface:TransportReturns a counter which gets incremented as data is read from the transport. It should only be used to determine if there is progress being made in reading the next command from the transport. The value may wrap into the negative numbers.- Specified by:
getReceiveCounterin interfaceTransport- Returns:
- a counter which gets incremented as data is read from the transport.
-
getPeerCertificates
public X509Certificate[] getPeerCertificates()
- Specified by:
getPeerCertificatesin interfaceTransport- Returns:
- the Certificates provided by the peer, or null if not a secure channel.
-
setPeerCertificates
public void setPeerCertificates(X509Certificate[] certificates)
Description copied from interface:TransportSets the certificates provided by the connected peer.- Specified by:
setPeerCertificatesin interfaceTransport- Parameters:
certificates- the Certificates provided by the peer.
-
getWireFormat
public WireFormat getWireFormat()
Description copied from interface:TransportRetrieves the WireFormat instance associated with this Transport instance.- Specified by:
getWireFormatin interfaceTransport- Returns:
- the WireFormat in use.
-
-