Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2013 Jeanfrancois Arcand
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations under
  * the License.
 package org.atmosphere.wasync.serial;
SerializedClient is a org.atmosphere.wasync.Client that guarantees ordered message delivery, in-line with the invocation sequence.

A sequence of fire calls over a SerializedClient's socket (created through create() :"message1").fire("message2");
guarantees that message1 arrives at the recipient-side before message2. By default, wAsync uses multiple underlying connections in delivering fire payloads. The SerializedClient guarantees that only one connection is used at any moment in time, while still providing an asynchronous fire interface to clients.

SerializedClient instances can be configured by means of a SerializedFireStage in deciding on the exact staging semantics and the (non-functional) quality properties of a supporting stage. The default implementation provided is DefaultSerializedFireStage.

Christian Bach
     public Socket create(SerializedOptions options) {
         AsyncHttpClient asyncHttpClient = options.runtime();
         if (asyncHttpClient == null || asyncHttpClient.isClosed()) {
             asyncHttpClient = ClientUtil.createDefaultAsyncHttpClient(options);
         return new SerializedSocket(options);

     public Socket create() {
         AsyncHttpClient asyncHttpClient = ClientUtil.createDefaultAsyncHttpClient(newOptionsBuilder().reconnect(true).build());
         return new SerializedSocket(
                 new SerializedOptionsBuilder()
                         .serializedFireStage(new DefaultSerializedFireStage())

         return new SerializedOptionsBuilder();

         SerializedRequestBuilder b = new SerializedRequestBuilder();
         return SerializedRequestBuilder.class.cast(b.resolver(.));

         AtmosphereRequestBuilder b;
         try {
             b = clazz.newInstance();
         } catch (InstantiationException e) {
             throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
    public static class SerializedRequestBuilder extends AtmosphereRequestBuilder {
        public SerializedRequestBuilder() {
New to GrepCode? Check out our FAQ X