tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jni/native/src poll.c
Date Mon, 18 Apr 2005 15:24:01 GMT
mturk       2005/04/18 08:24:01

  Modified:    jni/examples/org/apache/tomcat/jni Echo.java
               jni/java/org/apache/tomcat/jni Poll.java
               jni/native/src poll.c
  Log:
  Remove obsolete Poll.socket, Poll.events and Poll.data calls.
  Now Api uses indexed array for Poll.poll to minimize the JNI calls.
  
  Revision  Changes    Path
  1.9       +6 -5      jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Echo.java	18 Apr 2005 14:06:42 -0000	1.8
  +++ Echo.java	18 Apr 2005 15:24:01 -0000	1.9
  @@ -180,13 +180,14 @@
                           Thread.sleep(1);
                           continue;
                       }
  -                    long [] desc = new long[16];
  +                    /* Four times size then  created pollset */
  +                    long [] desc = new long[64];
                       /* USe 1 second poll timeout */
                       int rv = Poll.poll(serverPollset, 1000000, desc);
                       for (int n = 0; n < rv; n++) {
  -                        long clientSock = Poll.socket(desc[n]);
  -                        int  workerId   = (int)Poll.data(desc[n]);
  -                        System.out.println("Poll flags " + Poll.events(desc[n]));
  +                        long clientSock = desc[n*4+1];
  +                        int  workerId   = (int)desc[n*4+2];
  +                        System.out.println("Poll flags " + desc[n*4]);
                           remove(clientSock, workerId);
                           Worker worker = new Worker(clientSock, workerId,
                                                      this.getClass().getName());
  
  
  
  1.7       +10 -19    jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java
  
  Index: Poll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Poll.java	15 Apr 2005 10:15:07 -0000	1.6
  +++ Poll.java	18 Apr 2005 15:24:01 -0000	1.7
  @@ -96,30 +96,21 @@
        * @param pollset The pollset to use
        * @param timeout Timeout in microseconds
        * @param descriptors Array of signalled descriptors (output parameter)
  +     *        The desctiptor array must be four times the size of pollset.
  +     *        and are populated as follows:
  +     * <PRE>
  +     * descriptors[n + 0] -> returned events
  +     * descriptors[n + 1] -> socket
  +     * descriptors[n + 2] -> client data
  +     * descriptors[n + 2] -> reserved
  +     * </PRE>
        * @return Number of signalled descriptors (output parameter)
  +     *         or negative APR error code.
        */
       public static native int poll(long pollset, long timeout,
                                     long [] descriptors);
   
       /**
  -     * Return socket from poll descriptor
  -     * @param polldesc The pollset decriptor to use
  -     */
  -    public static native long socket(long polldesc);
  -
  -    /**
  -     * Return client data from poll descriptor
  -     * @param polldesc The pollset decriptor to use
  -     */
  -    public static native long data(long polldesc);
  -
  -    /**
  -     * Return rtnevents from poll descriptor
  -     * @param polldesc The pollset decriptor to use
  -     */
  -    public static native int events(long polldesc);
  -    
  -    /**
        * Set the socket time to live.
        * @param pollset The pollset to use
        * @param ttl Timeout in microseconds
  
  
  
  1.8       +0 -24     jakarta-tomcat-connectors/jni/native/src/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/poll.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- poll.c	18 Apr 2005 13:53:33 -0000	1.7
  +++ poll.c	18 Apr 2005 15:24:01 -0000	1.8
  @@ -251,30 +251,6 @@
       return (jint)num;
   }
   
  -TCN_IMPLEMENT_CALL(jlong, Poll, socket)(TCN_STDARGS, jlong pollfd)
  -{
  -    apr_pollfd_t *fd = J2P(pollfd,  apr_pollfd_t *);
  -    UNREFERENCED_STDARGS;
  -    TCN_ASSERT(pollfd != 0);
  -    return P2J(fd->desc.s);
  -}
  -
  -TCN_IMPLEMENT_CALL(jlong, Poll, data)(TCN_STDARGS, jlong pollfd)
  -{
  -    apr_pollfd_t *fd = J2P(pollfd,  apr_pollfd_t *);
  -    UNREFERENCED_STDARGS;
  -    TCN_ASSERT(pollfd != 0);
  -    return P2J(fd->client_data);
  -}
  -
  -TCN_IMPLEMENT_CALL(jint, Poll, events)(TCN_STDARGS, jlong pollfd)
  -{
  -    apr_pollfd_t *fd = J2P(pollfd,  apr_pollfd_t *);
  -    UNREFERENCED_STDARGS;
  -    TCN_ASSERT(pollfd != 0);
  -    return (jint)fd->rtnevents;
  -}
  -
   TCN_IMPLEMENT_CALL(void, Poll, setTtl)(TCN_STDARGS, jlong pollset,
                                          jlong ttl)
   {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message