Java 类javax.websocket.SendHandler 实例源码
项目:tomcat7
文件:WsRemoteEndpointImplClient.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... data) {
long timeout = getSendTimeout();
if (timeout < 1) {
timeout = Long.MAX_VALUE;
}
SendHandlerToCompletionHandler sh2ch =
new SendHandlerToCompletionHandler(handler);
try {
channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS,
null, sh2ch);
} catch (IllegalStateException ise) {
sh2ch.failed(ise, null);
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplClient.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... data) {
long timeout = getSendTimeout();
if (timeout < 1) {
timeout = Long.MAX_VALUE;
}
SendHandlerToCompletionHandler sh2ch =
new SendHandlerToCompletionHandler(handler);
try {
channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS,
null, sh2ch);
} catch (IllegalStateException ise) {
sh2ch.failed(ise, null);
}
}
项目:redis-websocket-javaee
文件:MeetupGroupsLiveLeaderboardEndpoint.java
public void broadcast(@Observes @LeaderDataQualifier String leaderboard) {
for (final Session s : CLIENTS) {
if (s != null && s.isOpen()) {
/**
* Asynchronous push
*/
s.getAsyncRemote().sendText(leaderboard, new SendHandler() {
@Override
public void onResult(SendResult result) {
if (result.isOK()) {
//Logger.getLogger(MeetupGroupsLiveLeaderboardEndpoint.class.getName()).log(Level.INFO, " sent to client {0}", s.getId());
} else {
Logger.getLogger(MeetupGroupsLiveLeaderboardEndpoint.class.getName()).log(Level.SEVERE, "Could not send to client " + s.getId(),
result.getException());
}
}
});
}
}
}
项目:zhq
文件:WebSocketServer.java
public void onOpen(final Session session, EndpointConfig endpointConfig) {
session.getAsyncRemote().sendText(
"Client Success!Your id is: " + session.getId());
session.addMessageHandler(new MessageHandler.Whole<String>() {
@Override
public void onMessage(String message) {
session.getAsyncRemote().sendObject(message, new SendHandler() {
@Override
public void onResult(SendResult result) {
System.out.println(session.getId() + ":"
+ result.isOK());
}
});
}
});
}
项目:reactive-hamster
文件:WebSocket.java
/**
* sendMessage is executed snychronously to avoid tomcat nativelib crashes.
* @param session
* @param message
* @param handler
*/
public synchronized static void sendMessage(final Session session, final String message, final SendHandler handler) {
// synchronized (session) {
try {
session.getBasicRemote().sendText(message);
handler.onResult(new SendResult());
} catch (IOException ex) {
Logger.getLogger(WebSocket.class.getName()).log(Level.SEVERE, null, ex);
handler.onResult(new SendResult(ex));
try {
//close broken session
session.close();
} catch (IOException ex1) {
Logger.getLogger(WebSocket.class.getName()).log(Level.SEVERE, null, ex1);
}
}
// }
// }
}
项目:internet_of_things_simulator
文件:MyEventServerSocket.java
@OnMessage
public void onWebSocketText(String message)
{
System.out.println("Received TEXT message: " + message);
try {
if ((session != null) && (session.isOpen()))
{
System.out.println("Echoing back text message "+message);
session.getAsyncRemote().sendText("Received: "+message,new SendHandler(){
@Override
public void onResult(SendResult arg0) {
if (!arg0.isOK()){
System.out.println("Error Sending Response: "+arg0.getException().getMessage());
}
}
});
}
} catch (Exception e){
System.out.println("Error: "+e.getMessage());
e.printStackTrace();
}
}
项目:jReto
文件:RemoteP2PConnection.java
@Override
public void writeData(ByteBuffer data) {
if (!this.isConnected()) {
System.err.println("attempted to write before connection is open.");
return;
}
new Thread(() ->
this.dataSession.getAsyncRemote().sendBinary(data, new SendHandler() {
@Override
public void onResult(SendResult arg0) {
RemoteP2PConnection.this.executor.execute(new Runnable() {
@Override
public void run() {
if (RemoteP2PConnection.this.handler != null) RemoteP2PConnection.this.handler.onDataSent(RemoteP2PConnection.this);
}
});
}
})).start();
}
项目:JavaIncrementalParser
文件:MyEndpointHandler.java
@Override
public void onOpen(final Session session, EndpointConfig ec) {
session.addMessageHandler(new MessageHandler.Whole<String>() {
@Override
public void onMessage(String data) {
System.out.println("Received (MyEndpointHandler) : " + data);
session.getAsyncRemote().sendText(data, new SendHandler() {
@Override
public void onResult(SendResult sr) {
if (sr.isOK()) {
System.out.println("Message written to the socket (handler)");
} else {
System.out.println("Message NOT written to the socket (handler)");
sr.getException().printStackTrace();
}
}
});
}
});
}
项目:apache-tomcat-7.0.57
文件:WsRemoteEndpointImplClient.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... data) {
long timeout = getSendTimeout();
if (timeout < 1) {
timeout = Long.MAX_VALUE;
}
SendHandlerToCompletionHandler sh2ch =
new SendHandlerToCompletionHandler(handler);
try {
channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS,
null, sh2ch);
} catch (IllegalStateException ise) {
sh2ch.failed(ise, null);
}
}
项目:apache-tomcat-7.0.57
文件:WsRemoteEndpointImplClient.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... data) {
long timeout = getSendTimeout();
if (timeout < 1) {
timeout = Long.MAX_VALUE;
}
SendHandlerToCompletionHandler sh2ch =
new SendHandlerToCompletionHandler(handler);
try {
channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS,
null, sh2ch);
} catch (IllegalStateException ise) {
sh2ch.failed(ise, null);
}
}
项目:tomcat7
文件:WsRemoteEndpointImplBase.java
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) {
if (data == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
StateUpdateSendHandler sush = new StateUpdateSendHandler(handler);
stateMachine.binaryStart();
startMessage(Constants.OPCODE_BINARY, data, true, sush);
}
项目:tomcat7
文件:WsRemoteEndpointImplBase.java
public void sendStringByCompletion(String text, SendHandler handler) {
if (text == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder, encoderBuffer, this);
tmsh.write();
// TextMessageSendHandler will update stateMachine when it completes
}
项目:tomcat7
文件:WsRemoteEndpointImplBase.java
void endMessage(SendHandler handler, SendResult result) {
boolean doWrite = false;
MessagePart mpNext = null;
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
} else if (!closed){
// Session may have been closed unexpectedly in the middle of
// sending a fragmented message closing the endpoint. If this
// happens, clearly there is no point trying to send the rest of
// the message.
doWrite = true;
}
}
if (doWrite) {
// Actual write has to be outside sync block to avoid possible
// deadlock between messagePartLock and writeLock in
// o.a.coyote.http11.upgrade.AbstractServletOutputStream
writeMessagePart(mpNext);
}
wsSession.updateLastActive();
// Some handlers, such as the IntermediateMessageHandler, do not have a
// nested handler so handler may be null.
if (handler != null) {
handler.onResult(result);
}
}
项目:tomcat7
文件:WsRemoteEndpointImplBase.java
public TextMessageSendHandler(SendHandler handler, CharBuffer message,
boolean isLast, CharsetEncoder encoder,
ByteBuffer encoderBuffer, WsRemoteEndpointImplBase endpoint) {
this.handler = handler;
this.message = message;
this.isLast = isLast;
this.encoder = encoder.reset();
this.buffer = encoderBuffer;
this.endpoint = endpoint;
}
项目:tomcat7
文件:WsRemoteEndpointImplBase.java
public OutputBufferSendHandler(SendHandler completion,
ByteBuffer headerBuffer, ByteBuffer payload, byte[] mask,
ByteBuffer outputBuffer, boolean flushRequired,
WsRemoteEndpointImplBase endpoint) {
this.handler = completion;
this.headerBuffer = headerBuffer;
this.payload = payload;
this.mask = mask;
this.outputBuffer = outputBuffer;
this.flushRequired = flushRequired;
this.endpoint = endpoint;
}
项目:tomcat7
文件:WsRemoteEndpointImplServer.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... buffers) {
this.handler = handler;
this.buffers = buffers;
// This is definitely the same thread that triggered the write so a
// dispatch will be required.
onWritePossible(true);
}
项目:tomcat7
文件:WsRemoteEndpointImplServer.java
/**
*
* @param t The throwable associated with any error that
* occurred
* @param useDispatch Should {@link SendHandler#onResult(SendResult)} be
* called from a new thread, keeping in mind the
* requirements of
* {@link javax.websocket.RemoteEndpoint.Async}
*/
private void clearHandler(Throwable t, boolean useDispatch) {
// Setting the result marks this (partial) message as
// complete which means the next one may be sent which
// could update the value of the handler. Therefore, keep a
// local copy before signalling the end of the (partial)
// message.
SendHandler sh = handler;
handler = null;
buffers = null;
if (sh != null) {
if (useDispatch) {
OnResultRunnable r = onResultRunnables.poll();
if (r == null) {
r = new OnResultRunnable(onResultRunnables);
}
r.init(sh, t);
if (executorService == null || executorService.isShutdown()) {
// Can't use the executor so call the runnable directly.
// This may not be strictly specification compliant in all
// cases but during shutdown only close messages are going
// to be sent so there should not be the issue of nested
// calls leading to stack overflow as described in bug
// 55715. The issues with nested calls was the reason for
// the separate thread requirement in the specification.
r.run();
} else {
executorService.execute(r);
}
} else {
if (t == null) {
sh.onResult(new SendResult());
} else {
sh.onResult(new SendResult(t));
}
}
}
}
项目:tomcat7
文件:MessagePart.java
public MessagePart( boolean fin, int rsv, byte opCode, ByteBuffer payload,
SendHandler intermediateHandler, SendHandler endHandler) {
this.fin = fin;
this.rsv = rsv;
this.opCode = opCode;
this.payload = payload;
this.intermediateHandler = intermediateHandler;
this.endHandler = endHandler;
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplBase.java
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) {
if (data == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
StateUpdateSendHandler sush = new StateUpdateSendHandler(handler);
stateMachine.binaryStart();
startMessage(Constants.OPCODE_BINARY, data, true, sush);
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplBase.java
public void sendStringByCompletion(String text, SendHandler handler) {
if (text == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder, encoderBuffer, this);
tmsh.write();
// TextMessageSendHandler will update stateMachine when it completes
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplBase.java
void endMessage(SendHandler handler, SendResult result) {
boolean doWrite = false;
MessagePart mpNext = null;
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
} else if (!closed){
// Session may have been closed unexpectedly in the middle of
// sending a fragmented message closing the endpoint. If this
// happens, clearly there is no point trying to send the rest of
// the message.
doWrite = true;
}
}
if (doWrite) {
// Actual write has to be outside sync block to avoid possible
// deadlock between messagePartLock and writeLock in
// o.a.coyote.http11.upgrade.AbstractServletOutputStream
writeMessagePart(mpNext);
}
wsSession.updateLastActive();
// Some handlers, such as the IntermediateMessageHandler, do not have a
// nested handler so handler may be null.
if (handler != null) {
handler.onResult(result);
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplBase.java
public TextMessageSendHandler(SendHandler handler, CharBuffer message,
boolean isLast, CharsetEncoder encoder,
ByteBuffer encoderBuffer, WsRemoteEndpointImplBase endpoint) {
this.handler = handler;
this.message = message;
this.isLast = isLast;
this.encoder = encoder.reset();
this.buffer = encoderBuffer;
this.endpoint = endpoint;
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplBase.java
public OutputBufferSendHandler(SendHandler completion,
ByteBuffer headerBuffer, ByteBuffer payload, byte[] mask,
ByteBuffer outputBuffer, boolean flushRequired,
WsRemoteEndpointImplBase endpoint) {
this.handler = completion;
this.headerBuffer = headerBuffer;
this.payload = payload;
this.mask = mask;
this.outputBuffer = outputBuffer;
this.flushRequired = flushRequired;
this.endpoint = endpoint;
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplServer.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... buffers) {
this.handler = handler;
this.buffers = buffers;
// This is definitely the same thread that triggered the write so a
// dispatch will be required.
onWritePossible(true);
}
项目:apache-tomcat-7.0.73-with-comment
文件:WsRemoteEndpointImplServer.java
/**
*
* @param t The throwable associated with any error that
* occurred
* @param useDispatch Should {@link SendHandler#onResult(SendResult)} be
* called from a new thread, keeping in mind the
* requirements of
* {@link javax.websocket.RemoteEndpoint.Async}
*/
private void clearHandler(Throwable t, boolean useDispatch) {
// Setting the result marks this (partial) message as
// complete which means the next one may be sent which
// could update the value of the handler. Therefore, keep a
// local copy before signalling the end of the (partial)
// message.
SendHandler sh = handler;
handler = null;
buffers = null;
if (sh != null) {
if (useDispatch) {
OnResultRunnable r = onResultRunnables.poll();
if (r == null) {
r = new OnResultRunnable(onResultRunnables);
}
r.init(sh, t);
if (executorService == null || executorService.isShutdown()) {
// Can't use the executor so call the runnable directly.
// This may not be strictly specification compliant in all
// cases but during shutdown only close messages are going
// to be sent so there should not be the issue of nested
// calls leading to stack overflow as described in bug
// 55715. The issues with nested calls was the reason for
// the separate thread requirement in the specification.
r.run();
} else {
executorService.execute(r);
}
} else {
if (t == null) {
sh.onResult(new SendResult());
} else {
sh.onResult(new SendResult(t));
}
}
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:MessagePart.java
public MessagePart( boolean fin, int rsv, byte opCode, ByteBuffer payload,
SendHandler intermediateHandler, SendHandler endHandler) {
this.fin = fin;
this.rsv = rsv;
this.opCode = opCode;
this.payload = payload;
this.intermediateHandler = intermediateHandler;
this.endHandler = endHandler;
}
项目:lazycat
文件:WsRemoteEndpointImplBase.java
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) {
if (data == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
StateUpdateSendHandler sush = new StateUpdateSendHandler(handler);
stateMachine.binaryStart();
startMessage(Constants.OPCODE_BINARY, data, true, sush);
}
项目:lazycat
文件:WsRemoteEndpointImplBase.java
public void sendStringByCompletion(String text, SendHandler handler) {
if (text == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
}
if (handler == null) {
throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler, CharBuffer.wrap(text), true, encoder,
encoderBuffer, this);
tmsh.write();
// TextMessageSendHandler will update stateMachine when it completes
}
项目:lazycat
文件:WsRemoteEndpointImplBase.java
void endMessage(SendHandler handler, SendResult result) {
boolean doWrite = false;
MessagePart mpNext = null;
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
} else if (!closed) {
// Session may have been closed unexpectedly in the middle of
// sending a fragmented message closing the endpoint. If this
// happens, clearly there is no point trying to send the rest of
// the message.
doWrite = true;
}
}
if (doWrite) {
// Actual write has to be outside sync block to avoid possible
// deadlock between messagePartLock and writeLock in
// o.a.coyote.http11.upgrade.AbstractServletOutputStream
writeMessagePart(mpNext);
}
wsSession.updateLastActive();
// Some handlers, such as the IntermediateMessageHandler, do not have a
// nested handler so handler may be null.
if (handler != null) {
handler.onResult(result);
}
}
项目:lazycat
文件:WsRemoteEndpointImplBase.java
public TextMessageSendHandler(SendHandler handler, CharBuffer message, boolean isLast, CharsetEncoder encoder,
ByteBuffer encoderBuffer, WsRemoteEndpointImplBase endpoint) {
this.handler = handler;
this.message = message;
this.isLast = isLast;
this.encoder = encoder.reset();
this.buffer = encoderBuffer;
this.endpoint = endpoint;
}
项目:lazycat
文件:WsRemoteEndpointImplBase.java
public OutputBufferSendHandler(SendHandler completion, ByteBuffer headerBuffer, ByteBuffer payload, byte[] mask,
ByteBuffer outputBuffer, boolean flushRequired, WsRemoteEndpointImplBase endpoint) {
this.handler = completion;
this.headerBuffer = headerBuffer;
this.payload = payload;
this.mask = mask;
this.outputBuffer = outputBuffer;
this.flushRequired = flushRequired;
this.endpoint = endpoint;
}
项目:lazycat
文件:WsRemoteEndpointImplClient.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... data) {
long timeout = getSendTimeout();
if (timeout < 1) {
timeout = Long.MAX_VALUE;
}
SendHandlerToCompletionHandler sh2ch = new SendHandlerToCompletionHandler(handler);
try {
channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS, null, sh2ch);
} catch (IllegalStateException ise) {
sh2ch.failed(ise, null);
}
}
项目:lazycat
文件:WsRemoteEndpointImplServer.java
@Override
protected void doWrite(SendHandler handler, ByteBuffer... buffers) {
this.handler = handler;
this.buffers = buffers;
// This is definitely the same thread that triggered the write so a
// dispatch will be required.
onWritePossible(true);
}
项目:lazycat
文件:WsRemoteEndpointImplServer.java
/**
*
* @param t
* The throwable associated with any error that occurred
* @param useDispatch
* Should {@link SendHandler#onResult(SendResult)} be called from
* a new thread, keeping in mind the requirements of
* {@link javax.websocket.RemoteEndpoint.Async}
*/
private void clearHandler(Throwable t, boolean useDispatch) {
// Setting the result marks this (partial) message as
// complete which means the next one may be sent which
// could update the value of the handler. Therefore, keep a
// local copy before signalling the end of the (partial)
// message.
SendHandler sh = handler;
handler = null;
buffers = null;
if (sh != null) {
if (useDispatch) {
OnResultRunnable r = onResultRunnables.poll();
if (r == null) {
r = new OnResultRunnable(onResultRunnables);
}
r.init(sh, t);
if (executorService == null || executorService.isShutdown()) {
// Can't use the executor so call the runnable directly.
// This may not be strictly specification compliant in all
// cases but during shutdown only close messages are going
// to be sent so there should not be the issue of nested
// calls leading to stack overflow as described in bug
// 55715. The issues with nested calls was the reason for
// the separate thread requirement in the specification.
r.run();
} else {
executorService.execute(r);
}
} else {
if (t == null) {
sh.onResult(new SendResult());
} else {
sh.onResult(new SendResult(t));
}
}
}
}
项目:lazycat
文件:MessagePart.java
public MessagePart(boolean fin, int rsv, byte opCode, ByteBuffer payload, SendHandler intermediateHandler,
SendHandler endHandler) {
this.fin = fin;
this.rsv = rsv;
this.opCode = opCode;
this.payload = payload;
this.intermediateHandler = intermediateHandler;
this.endHandler = endHandler;
}
项目:class-guard
文件:WsRemoteEndpointImplBase.java
public void sendStringByCompletion(String text, SendHandler handler) {
stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder, encoderBuffer, this);
tmsh.write();
// TextMessageSendHandler will update stateMachine when it completes
}
项目:class-guard
文件:WsRemoteEndpointImplBase.java
void startMessage(byte opCode, ByteBuffer payload, boolean last,
SendHandler handler) {
wsSession.updateLastActive();
MessagePart mp = new MessagePart(opCode, payload, last, handler, this);
boolean doWrite = false;
synchronized (messagePartLock) {
if (Constants.OPCODE_CLOSE == mp.getOpCode()) {
try {
setBatchingAllowed(false);
} catch (IOException e) {
log.warn(sm.getString(
"wsRemoteEndpoint.flushOnCloseFailed"), e);
}
}
if (messagePartInProgress) {
// When a control message is sent while another message is being
// sent, the control message is queued. Chances are the
// subsequent data message part will end up queued while the
// control message is sent. The logic in this class (state
// machine, EndMessageHandler, TextMessageSendHandler) ensures
// that there will only ever be one data message part in the
// queue. There could be multiple control messages in the queue.
// Add it to the queue
messagePartQueue.add(mp);
} else {
messagePartInProgress = true;
doWrite = true;
}
}
if (doWrite) {
// Actual write has to be outside sync block to avoid possible
// deadlock between messagePartLock and writeLock in
// o.a.coyote.http11.upgrade.AbstractServletOutputStream
writeMessagePart(mp);
}
}
项目:class-guard
文件:WsRemoteEndpointImplBase.java
void endMessage(SendHandler handler, SendResult result) {
boolean doWrite = false;
MessagePart mpNext = null;
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
} else if (!closed){
// Session may have been closed unexpectedly in the middle of
// sending a fragmented message closing the endpoint. If this
// happens, clearly there is no point trying to send the rest of
// the message.
doWrite = true;
}
}
if (doWrite) {
// Actual write has to be outside sync block to avoid possible
// deadlock between messagePartLock and writeLock in
// o.a.coyote.http11.upgrade.AbstractServletOutputStream
writeMessagePart(mpNext);
}
wsSession.updateLastActive();
handler.onResult(result);
}
项目:class-guard
文件:WsRemoteEndpointImplBase.java
public MessagePart(byte opCode, ByteBuffer payload, boolean last,
SendHandler handler, WsRemoteEndpointImplBase endpoint) {
this.opCode = opCode;
this.payload = payload;
this.last = last;
this.handler = new EndMessageHandler(endpoint, handler);
}
项目:class-guard
文件:WsRemoteEndpointImplBase.java
public TextMessageSendHandler(SendHandler handler, CharBuffer message,
boolean isLast, CharsetEncoder encoder,
ByteBuffer encoderBuffer, WsRemoteEndpointImplBase endpoint) {
this.handler = handler;
this.message = message;
this.isLast = isLast;
this.encoder = encoder.reset();
this.buffer = encoderBuffer;
this.endpoint = endpoint;
}