Methods Summary |
---|
public void | close()
if (inputStream != null) {
byteBufferInputStreamPool.release(inputStream);
inputStream = null;
}
if (outputStream != null) {
byteBufferOutputStreamPool.release(outputStream);
outputStream = null;
}
socketChannel.close();
|
public static com.sun.xml.ws.transport.tcp.io.Connection | create(java.lang.String host, int port)
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, MessagesMessages.WSTCP_1051_CONNECTION_OPEN_TCP_SOCKET(host, port));
}
final SocketChannel socketChannel = SocketChannel.open();
final Socket socket = socketChannel.socket();
socket.connect(new InetSocketAddress(host, port));
socketChannel.configureBlocking(false);
final Connection connection = new Connection(socketChannel);
final ByteBuffer byteBuffer = ByteBufferFactory.allocateView(TCPConstants.DEFAULT_FRAME_SIZE, TCPConstants.DEFAULT_USE_DIRECT_BUFFER);
byteBuffer.position(0);
byteBuffer.limit(0);
connection.setInputStreamByteBuffer(byteBuffer);
return connection;
|
protected void | finalize()
close();
super.finalize();
|
public void | flush()
outputStream.flushLast();
|
public int | getChannelId()Get channel id
return channelId;
|
public int | getContentId()Get request/response contentId
return contentId;
|
public java.util.Map | getContentProperties()Get request content properties
return inputStream.getContentProperties();
|
public java.lang.String | getHost()
return getHost(socketChannel);
|
public static java.lang.String | getHost(java.nio.channels.SocketChannel socketChannel)
return socketChannel.socket().getInetAddress().getHostAddress();
|
public java.lang.String | getLocalHost()
return getLocalHost(socketChannel);
|
public static java.lang.String | getLocalHost(java.nio.channels.SocketChannel socketChannel)
return socketChannel.socket().getLocalAddress().getHostAddress();
|
public int | getLocalPort()
return getLocalPort(socketChannel);
|
public static int | getLocalPort(java.nio.channels.SocketChannel socketChannel)
return socketChannel.socket().getLocalPort();
|
public int | getMessageId()Get request/response messageId of 1st frame
return messageId;
|
public int | getPort()
return getPort(socketChannel);
|
public static int | getPort(java.nio.channels.SocketChannel socketChannel)
return socketChannel.socket().getPort();
|
public java.nio.channels.SocketChannel | getSocketChannel()
return socketChannel;
|
public boolean | isDirectMode()
return isDirectMode;
|
public java.io.InputStream | openInputStream()
final BufferedMessageInputStream is = new BufferedMessageInputStream(inputStream);
inputStreamRef = new WeakReference<BufferedMessageInputStream>(is);
return is;
|
public java.io.OutputStream | openOutputStream()
outputStream.setChannelId(channelId);
outputStream.setMessageId(messageId);
outputStream.setContentId(contentId);
return outputStream;
|
public void | prepareForReading()
if (inputStreamRef != null) {
final BufferedMessageInputStream is = inputStreamRef.get();
// if InputStream is used by some lazy reader - buffer message
if (inputStream.isMessageInProcess() && is != null && !is.isClosed()) {
is.bufferMessage();
logger.log(Level.FINEST, MessagesMessages.WSTCP_1050_CONNECTION_BUFFERING_IS(is.getBufferedSize()));
}
}
// double check input stream doesnt have earlier read message
if (inputStream.isMessageInProcess()) {
inputStream.skipToEndOfMessage();
}
inputStream.reset();
outputStream.reset();
inputStream.forceHeaderRead();
channelId = inputStream.getChannelId();
messageId = inputStream.getMessageId();
if (FrameType.isFrameContainsParams(messageId)) {
contentId = inputStream.getContentId();
}
|
public void | setChannelId(int channelId)Set channel id
this.channelId = channelId;
|
public void | setContentId(int contentId)Set request/response contentId
this.contentId = contentId;
|
public void | setContentProperty(int key, java.lang.String value)Set response content properties
outputStream.setContentProperty(key, value);
|
public void | setDirectMode(boolean isDirectMode)
this.isDirectMode = isDirectMode;
inputStream.setDirectMode(isDirectMode);
outputStream.setDirectMode(isDirectMode);
|
public void | setInputStreamByteBuffer(java.nio.ByteBuffer messageBuffer)Set messageBuffer for InputStream
some message part could be preread before
inputStream.setByteBuffer(messageBuffer);
|
public void | setMessageId(int messageId)Set request/response messageId of 1st frame
this.messageId = messageId;
|
public void | setSocketChannel(java.nio.channels.SocketChannel socketChannel)
this.socketChannel = socketChannel;
inputStream.setSocketChannel(socketChannel);
outputStream.setSocketChannel(socketChannel);
|
public java.lang.String | toString()
return "host: " + getHost() + " port: " + getPort();
|