jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1663096 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java
Date Sun, 01 Mar 2015 13:35:41 GMT
Author: pmouawad
Date: Sun Mar  1 13:35:40 2015
New Revision: 1663096

URL: http://svn.apache.org/r1663096
Log:
Ensure close always occurs

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java?rev=1663096&r1=1663095&r2=1663096&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/SocketOutputStreamPoolFactory.java
Sun Mar  1 13:35:40 2015
@@ -25,6 +25,7 @@ import org.apache.commons.pool2.BaseKeye
 import org.apache.commons.pool2.KeyedPooledObjectFactory;
 import org.apache.commons.pool2.PooledObject;
 import org.apache.commons.pool2.impl.DefaultPooledObject;
+import org.apache.jorphan.util.JOrphanUtils;
 
 /**
  * Pool Factory of {@link SocketOutputStream}
@@ -51,8 +52,10 @@ public class SocketOutputStreamPoolFacto
     public void destroyObject(SocketConnectionInfos socketConnectionInfos, PooledObject<SocketOutputStream>
socketOutputStream) throws Exception {
         super.destroyObject(socketConnectionInfos, socketOutputStream);
         SocketOutputStream outputStream = socketOutputStream.getObject();
-        outputStream.close();
-        outputStream.getSocket().close();
+        JOrphanUtils.closeQuietly(outputStream);
+        if(outputStream.getSocket() != null) {
+            JOrphanUtils.closeQuietly(outputStream.getSocket());
+        }
     }
 
     /**



Mime
View raw message