Merge jdk8-b55

Thu, 30 Aug 2012 20:10:29 -0700

author
lana
date
Thu, 30 Aug 2012 20:10:29 -0700
changeset 393
e8a0e84383d6
parent 390
6b2a363213f4
parent 392
d086e67eb9dd
child 394
bf1bb47414e1

Merge

     1.1 --- a/src/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java	Thu Aug 30 10:27:01 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java	Thu Aug 30 20:10:29 2012 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -25,7 +25,10 @@
    1.11  
    1.12  package com.sun.corba.se.impl.transport;
    1.13  
    1.14 -import java.util.Hashtable;
    1.15 +import java.util.Collections;
    1.16 +import java.util.HashMap;
    1.17 +import java.util.Iterator;
    1.18 +import java.util.Map;
    1.19  
    1.20  import org.omg.CORBA.CompletionStatus;
    1.21  import org.omg.CORBA.SystemException;
    1.22 @@ -68,7 +71,7 @@
    1.23  
    1.24      private CorbaConnection connection;
    1.25      // Maps requestId to an OutCallDesc.
    1.26 -    private Hashtable out_calls = null; // REVISIT - use int hastable/map
    1.27 +    final private Map<Integer, OutCallDesc> out_calls;
    1.28  
    1.29      public CorbaResponseWaitingRoomImpl(ORB orb, CorbaConnection connection)
    1.30      {
    1.31 @@ -76,7 +79,8 @@
    1.32          wrapper = ORBUtilSystemException.get( orb,
    1.33              CORBALogDomains.RPC_TRANSPORT ) ;
    1.34          this.connection = connection;
    1.35 -        out_calls = new Hashtable();
    1.36 +        out_calls =
    1.37 +            Collections.synchronizedMap(new HashMap<Integer, OutCallDesc>());
    1.38      }
    1.39  
    1.40      ////////////////////////////////////////////////////
    1.41 @@ -139,7 +143,7 @@
    1.42              return null;
    1.43          }
    1.44  
    1.45 -        OutCallDesc call = (OutCallDesc)out_calls.get(requestId);
    1.46 +        OutCallDesc call = out_calls.get(requestId);
    1.47          if (call == null) {
    1.48              throw wrapper.nullOutCall(CompletionStatus.COMPLETED_MAYBE);
    1.49          }
    1.50 @@ -197,7 +201,7 @@
    1.51          LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage)
    1.52              inputObject.getMessageHeader();
    1.53          Integer requestId = new Integer(header.getRequestId());
    1.54 -        OutCallDesc call = (OutCallDesc) out_calls.get(requestId);
    1.55 +        OutCallDesc call = out_calls.get(requestId);
    1.56  
    1.57          if (orb.transportDebugFlag) {
    1.58              dprint(".responseReceived: id/"
    1.59 @@ -248,7 +252,6 @@
    1.60  
    1.61      public int numberRegistered()
    1.62      {
    1.63 -        // Note: Hashtable.size() is not synchronized
    1.64          return out_calls.size();
    1.65      }
    1.66  
    1.67 @@ -264,29 +267,41 @@
    1.68              dprint(".signalExceptionToAllWaiters: " + systemException);
    1.69          }
    1.70  
    1.71 -        OutCallDesc call;
    1.72 -        java.util.Enumeration e = out_calls.elements();
    1.73 -        while(e.hasMoreElements()) {
    1.74 -            call = (OutCallDesc) e.nextElement();
    1.75 +        synchronized (out_calls) {
    1.76 +            if (orb.transportDebugFlag) {
    1.77 +                dprint(".signalExceptionToAllWaiters: out_calls size :" +
    1.78 +                       out_calls.size());
    1.79 +            }
    1.80  
    1.81 -            synchronized(call.done){
    1.82 -                // anything waiting for BufferManagerRead's fragment queue
    1.83 -                // needs to be cancelled
    1.84 -                CorbaMessageMediator corbaMsgMediator =
    1.85 -                             (CorbaMessageMediator)call.messageMediator;
    1.86 -                CDRInputObject inputObject =
    1.87 -                           (CDRInputObject)corbaMsgMediator.getInputObject();
    1.88 -                // IMPORTANT: If inputObject is null, then no need to tell
    1.89 -                //            BufferManagerRead to cancel request processing.
    1.90 -                if (inputObject != null) {
    1.91 -                    BufferManagerReadStream bufferManager =
    1.92 -                        (BufferManagerReadStream)inputObject.getBufferManager();
    1.93 -                    int requestId = corbaMsgMediator.getRequestId();
    1.94 -                    bufferManager.cancelProcessing(requestId);
    1.95 +            for (OutCallDesc call : out_calls.values()) {
    1.96 +                if (orb.transportDebugFlag) {
    1.97 +                    dprint(".signalExceptionToAllWaiters: signaling " +
    1.98 +                            call);
    1.99                  }
   1.100 -                call.inputObject = null;
   1.101 -                call.exception = systemException;
   1.102 -                call.done.notify();
   1.103 +                synchronized(call.done) {
   1.104 +                    try {
   1.105 +                        // anything waiting for BufferManagerRead's fragment queue
   1.106 +                        // needs to be cancelled
   1.107 +                        CorbaMessageMediator corbaMsgMediator =
   1.108 +                                     (CorbaMessageMediator)call.messageMediator;
   1.109 +                        CDRInputObject inputObject =
   1.110 +                                   (CDRInputObject)corbaMsgMediator.getInputObject();
   1.111 +                        // IMPORTANT: If inputObject is null, then no need to tell
   1.112 +                        //            BufferManagerRead to cancel request processing.
   1.113 +                        if (inputObject != null) {
   1.114 +                            BufferManagerReadStream bufferManager =
   1.115 +                                (BufferManagerReadStream)inputObject.getBufferManager();
   1.116 +                            int requestId = corbaMsgMediator.getRequestId();
   1.117 +                            bufferManager.cancelProcessing(requestId);
   1.118 +                        }
   1.119 +                    } catch (Exception e) {
   1.120 +                    } finally {
   1.121 +                        // attempt to wake up waiting threads in all cases
   1.122 +                        call.inputObject = null;
   1.123 +                        call.exception = systemException;
   1.124 +                        call.done.notifyAll();
   1.125 +                    }
   1.126 +                }
   1.127              }
   1.128          }
   1.129      }
   1.130 @@ -294,7 +309,7 @@
   1.131      public MessageMediator getMessageMediator(int requestId)
   1.132      {
   1.133          Integer id = new Integer(requestId);
   1.134 -        OutCallDesc call = (OutCallDesc) out_calls.get(id);
   1.135 +        OutCallDesc call = out_calls.get(id);
   1.136          if (call == null) {
   1.137              // This can happen when getting early reply fragments for a
   1.138              // request which has completed (e.g., client marshaling error).
     2.1 --- a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java	Thu Aug 30 10:27:01 2012 -0700
     2.2 +++ b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java	Thu Aug 30 20:10:29 2012 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -1521,7 +1521,7 @@
    2.11              // connection and give them the SystemException;
    2.12  
    2.13              responseWaitingRoom.signalExceptionToAllWaiters(systemException);
    2.14 -
    2.15 +        } finally {
    2.16              if (contactInfo != null) {
    2.17                  ((OutboundConnectionCache)getConnectionCache()).remove(contactInfo);
    2.18              } else if (acceptor != null) {
    2.19 @@ -1542,7 +1542,6 @@
    2.20  
    2.21              writeUnlock();
    2.22  
    2.23 -        } finally {
    2.24              if (orb.transportDebugFlag) {
    2.25                  dprint(".purgeCalls<-: "
    2.26                         + minor_code + "/" + die + "/" + lockHeld

mercurial