Exemplo n.º 1
0
 /**
  * Validates the option flags that each interceptor is using and reports an error if two
  * interceptor share the same flag.
  *
  * @throws ChannelException Error with option flag
  */
 protected void checkOptionFlags() throws ChannelException {
   StringBuilder conflicts = new StringBuilder();
   ChannelInterceptor first = interceptors;
   while (first != null) {
     int flag = first.getOptionFlag();
     if (flag != 0) {
       ChannelInterceptor next = first.getNext();
       while (next != null) {
         int nflag = next.getOptionFlag();
         if (nflag != 0 && (((flag & nflag) == flag) || ((flag & nflag) == nflag))) {
           conflicts.append("[");
           conflicts.append(first.getClass().getName());
           conflicts.append(":");
           conflicts.append(flag);
           conflicts.append(" == ");
           conflicts.append(next.getClass().getName());
           conflicts.append(":");
           conflicts.append(nflag);
           conflicts.append("] ");
         } // end if
         next = next.getNext();
       } // while
     } // end if
     first = first.getNext();
   } // while
   if (conflicts.length() > 0)
     throw new ChannelException(
         sm.getString("groupChannel.optionFlag.conflict", conflicts.toString()));
 }
Exemplo n.º 2
0
 @Override
 public ChannelInterceptor next() {
   ChannelInterceptor result = null;
   if (hasNext()) {
     result = start;
     start = start.getNext();
   }
   return result;
 }
 @Override
 public ChannelInterceptor next() {
   try {
     ChannelInterceptor result = null;
     if (hasNextRemote()) {
       result = start;
       start = start.getNext();
     }
     return result;
   } catch (Exception excp) {
     excp.printStackTrace();
   }
   return null;
 }
Exemplo n.º 4
0
 /**
  * Adds an interceptor to the stack for message processing<br>
  * Interceptors are ordered in the way they are added.<br>
  * <code>channel.addInterceptor(A);</code><br>
  * <code>channel.addInterceptor(C);</code><br>
  * <code>channel.addInterceptor(B);</code><br>
  * Will result in a interceptor stack like this:<br>
  * <code>A -&gt; C -&gt; B</code><br>
  * The complete stack will look like this:<br>
  * <code>Channel -&gt; A -&gt; C -&gt; B -&gt; ChannelCoordinator</code><br>
  *
  * @param interceptor ChannelInterceptorBase
  */
 @Override
 public void addInterceptor(ChannelInterceptor interceptor) {
   if (interceptors == null) {
     interceptors = interceptor;
     interceptors.setNext(coordinator);
     interceptors.setPrevious(null);
     coordinator.setPrevious(interceptors);
   } else {
     ChannelInterceptor last = interceptors;
     while (last.getNext() != coordinator) {
       last = last.getNext();
     }
     last.setNext(interceptor);
     interceptor.setNext(coordinator);
     interceptor.setPrevious(last);
     coordinator.setPrevious(interceptor);
   }
 }