[grizzly~git:12d62cc0] [2.3.x] + fix issue #1422

  • From: oleksiys@...
  • To: commits@...
  • Subject: [grizzly~git:12d62cc0] [2.3.x] + fix issue #1422
  • Date: Sat, 2 Feb 2013 00:02:31 +0000

Project:    grizzly
Repository: git
Revision:   12d62cc0c81d9530dd8d00add7a77bfad798563f
Author:     oleksiys
Date:       2013-02-02 00:00:51 UTC
Link:       

Log Message:
------------
[2.3.x] + fix issue #1422
http://java.net/jira/browse/GRIZZLY-1422
"Perf regression introduced in 2.3-beta9"


Revisions:
----------
12d62cc0c81d9530dd8d00add7a77bfad798563f


Modified Paths:
---------------
modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLFilter.java
modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLUtils.java


Diffs:
------
diff --git 
a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java 
b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
index b01a5f3..123f3dd 100644
--- 
a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
+++ 
b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
@@ -229,7 +229,7 @@ public class SSLBaseFilter extends BaseFilter {
     public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent 
event) throws IOException {
         if (event.type() == CertificateEvent.TYPE) {
             final CertificateEvent ce = (CertificateEvent) event;
-            ce.certs = 
getPeerCertificateChain(getSslConnectionContext(ctx.getConnection()),
+            ce.certs = 
getPeerCertificateChain(obtainSslConnectionContext(ctx.getConnection()),
                                                ctx,
                                                ce.needClientAuth);
             return ctx.getStopAction();
@@ -241,7 +241,7 @@ public class SSLBaseFilter extends BaseFilter {
     public NextAction handleRead(final FilterChainContext ctx)
     throws IOException {
         final Connection connection = ctx.getConnection();
-        final SSLConnectionContext sslCtx = 
getSslConnectionContext(connection);
+        final SSLConnectionContext sslCtx = 
obtainSslConnectionContext(connection);
         SSLEngine sslEngine = sslCtx.getSslEngine();
         
         if (sslEngine != null && !isHandshaking(sslEngine)) {
@@ -290,7 +290,7 @@ public class SSLBaseFilter extends BaseFilter {
         
         synchronized(connection) {
             final Buffer output =
-                    wrapAll(ctx, getSslConnectionContext(connection));
+                    wrapAll(ctx, obtainSslConnectionContext(connection));
 
             final FilterChainContext.TransportContext transportContext =
                     ctx.getTransportContext();
@@ -896,7 +896,7 @@ public class SSLBaseFilter extends BaseFilter {
         public NextAction handleRead(final FilterChainContext ctx) throws 
IOException {
             final Connection connection = ctx.getConnection();
             final SSLConnectionContext sslCtx =
-                    getSslConnectionContext(connection);
+                    obtainSslConnectionContext(connection);
             
             if (sslCtx.getSslEngine() == null) {
                 final SSLEngine sslEngine = 
serverSSLEngineConfigurator.createSSLEngine();
@@ -965,7 +965,7 @@ public class SSLBaseFilter extends BaseFilter {
         @Override
         public Buffer clone(final Connection connection,
                 final Buffer originalMessage) {
-            final SSLConnectionContext sslCtx = 
getSslConnectionContext(connection);
+            final SSLConnectionContext sslCtx = 
obtainSslConnectionContext(connection);
 
             final int copyThreshold = sslCtx.getNetBufferSize() / 2;
 
diff --git 
a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLFilter.java 
b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLFilter.java
index dbeeae2..a8d2f2e 100644
--- a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLFilter.java
+++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLFilter.java
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 2008-2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008-2013 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
  * General Public License Version 2 only ("GPL") or the Common Development
@@ -135,7 +135,7 @@ public class SSLFilter extends SSLBaseFilter {
 
         synchronized (connection) {
             final SSLConnectionContext sslCtx =
-                    getSslConnectionContext(connection);
+                    obtainSslConnectionContext(connection);
             
             final SSLEngine sslEngine = sslCtx.getSslEngine();
             if (sslEngine != null && !isHandshaking(sslEngine)) {
@@ -212,7 +212,7 @@ public class SSLFilter extends SSLBaseFilter {
                           final SSLEngineConfigurator sslEngineConfigurator,
                           final FilterChainContext context)
     throws IOException {
-        final SSLConnectionContext sslCtx = 
getSslConnectionContext(connection);
+        final SSLConnectionContext sslCtx = 
obtainSslConnectionContext(connection);
         SSLEngine sslEngine = sslCtx.getSslEngine();
         
         if (sslEngine == null) {
diff --git 
a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLUtils.java 
b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLUtils.java
index 0938917..185faf0 100644
--- a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLUtils.java
+++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLUtils.java
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 2008-2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008-2013 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
  * General Public License Version 2 only ("GPL") or the Common Development
@@ -97,7 +97,7 @@ public final class SSLUtils {
     private static final int MIN_VERSION = 0x0300;
     private static final int MAX_MAJOR_VERSION = 0x03;
 
-    static SSLConnectionContext getSslConnectionContext(
+    static SSLConnectionContext obtainSslConnectionContext(
             final Connection connection) {
         SSLConnectionContext sslCtx = SSL_CTX_ATTR.get(connection);
         if (sslCtx == null) {
@@ -108,13 +108,19 @@ public final class SSLUtils {
         return sslCtx;
     }
     
+    static SSLConnectionContext getSslConnectionContext(
+            final Connection connection) {
+        return SSL_CTX_ATTR.get(connection);
+    }
+
     public static SSLEngine getSSLEngine(final Connection connection) {
-        return getSslConnectionContext(connection).getSslEngine();
+        final SSLConnectionContext sslCtx = 
getSslConnectionContext(connection);
+        return sslCtx == null ? null : sslCtx.getSslEngine();
     }
 
     public static void setSSLEngine(final Connection connection,
             SSLEngine sslEngine) {
-        getSslConnectionContext(connection).configure(sslEngine);
+        obtainSslConnectionContext(connection).configure(sslEngine);
     }
 
     /*




[grizzly~git:12d62cc0] [2.3.x] + fix issue #1422

oleksiys 02/02/2013
Terms of Use; Privacy Policy; Copyright ©2013-2016 (revision 20160708.bf2ac18)
 
 
Close
loading
Please Confirm
Close