axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject cvs commit: xml-axis/proposals/jabber/src/com/snellspace/axis/jabber JabberSender.java JabberTransport.java
Date Fri, 24 Jan 2003 23:05:21 GMT
jmsnell     2003/01/24 15:05:21

  Modified:    proposals/jabber/src/com/snellspace/axis/jabber
                        JabberSender.java JabberTransport.java
  Log:
  Adding support for one-way only operations.  In the old code, the JabberSender would block
until a response was received.  Now, a flag on the JabberTransport indicates whether or not
the Sender should wait.
  
  Revision  Changes    Path
  1.3       +17 -11    xml-axis/proposals/jabber/src/com/snellspace/axis/jabber/JabberSender.java
  
  Index: JabberSender.java
  ===================================================================
  RCS file: /home/cvs//xml-axis/proposals/jabber/src/com/snellspace/axis/jabber/JabberSender.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JabberSender.java	16 Jan 2003 06:24:05 -0000	1.2
  +++ JabberSender.java	24 Jan 2003 23:05:20 -0000	1.3
  @@ -37,19 +37,25 @@
             createRequestPacketFromMessage(
               context.getRequestMessage(), 
               context);
  +        boolean waitForResponse = 
  +          ((Boolean)context.getProperty(
  +            JabberTransport.JABBER_WAIT_FOR_RESPONSE))
  +              .booleanValue();
           connection.send(request, this);
  -        try {
  -          synchronized(this) {
  -            while (packet == null) {
  -              wait(1000);
  +        if (waitForResponse) {
  +          try {
  +            synchronized(this) {
  +              while (packet == null) {
  +                wait(1000);
  +              }
               }
  -          }
  -        } catch (InterruptedException e) {}
  -        Packet response = packet;
  -        context.setResponseMessage(
  -          createResponseMessageFromPacket(
  -            response, 
  -            context));
  +          } catch (InterruptedException e) {}
  +          Packet response = packet;
  +          context.setResponseMessage(
  +            createResponseMessageFromPacket(
  +              response, 
  +              context));
  +        }
           connection.disconnect();
           connection = null;
     }
  
  
  
  1.2       +14 -0     xml-axis/proposals/jabber/src/com/snellspace/axis/jabber/JabberTransport.java
  
  Index: JabberTransport.java
  ===================================================================
  RCS file: /home/cvs//xml-axis/proposals/jabber/src/com/snellspace/axis/jabber/JabberTransport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JabberTransport.java	31 Dec 2002 20:38:34 -0000	1.1
  +++ JabberTransport.java	24 Jan 2003 23:05:20 -0000	1.2
  @@ -13,8 +13,11 @@
     extends Transport {
   
     public static final String DEFAULT_TRANSPORT_NAME = "JabberSender";
  +  public static final String JABBER_WAIT_FOR_RESPONSE = 
  +    "com.snellspace.axis.jabber.JabberSender.WaitForResponse";
   
     private String to;
  +  private boolean waitForResponse = true;
   
     public JabberTransport() {
       transportName = DEFAULT_TRANSPORT_NAME;
  @@ -25,6 +28,14 @@
         this.transportName = transportName;
     }
   
  +  public boolean getWaitForResponse() {
  +    return waitForResponse;
  +  }
  +  
  +  public void setWaitForResponse(boolean waitForResponse) {
  +    this.waitForResponse = waitForResponse;
  +  }
  +
     public String getTo() {
       return to;
     }
  @@ -42,6 +53,9 @@
           context.setProperty(
             MessageContext.TRANS_URL,
             getTo());
  +        context.setProperty(
  +        JABBER_WAIT_FOR_RESPONSE,
  +        new Boolean(waitForResponse));
     }
   
   }
  
  
  

Mime
View raw message