[Git][java-team/disruptor][upstream] New upstream version 3.4.4

Tony Mancill (@tmancill) gitlab at salsa.debian.org
Sun Aug 15 23:59:21 BST 2021



Tony Mancill pushed to branch upstream at Debian Java Maintainers / disruptor


Commits:
783177b6 by tony mancill at 2021-08-15T14:53:50-07:00
New upstream version 3.4.4
- - - - -


5 changed files:

- README.md
- build.gradle
- src/main/java/com/lmax/disruptor/BatchEventProcessor.java
- + src/main/java/com/lmax/disruptor/ExceptionHandlers.java
- src/main/java/com/lmax/disruptor/dsl/ExceptionHandlerWrapper.java


Changes:

=====================================
README.md
=====================================
@@ -4,9 +4,7 @@ A High Performance Inter-Thread Messaging Library
 
 ## Maintainer
 
-[Michael Barker](https://github.com/mikeb01)
-
-[![Build Status](https://semaphoreci.com/api/v1/mikeb01/disruptor/branches/master/badge.svg)](https://semaphoreci.com/mikeb01/disruptor)
+LMAX Development Team
 
 ## Documentation
 
@@ -15,6 +13,14 @@ A High Performance Inter-Thread Messaging Library
 
 ## Changelog
 
+### 3.4.4
+
+- Lazy-loading of Logger instances
+
+### 3.4.3
+
+- Add Automatic-Module-Name to MANIFEST.MF
+
 ### 3.4.2
 
 - Fix race condition in BatchEventProcessor with 3 or more starting/halting concurrently.


=====================================
build.gradle
=====================================
@@ -24,7 +24,7 @@ apply plugin: 'idea'
 defaultTasks 'build'
 
 group = 'com.lmax'
-version = new Version(major: 3, minor: 4, revision: 2)
+version = new Version(major: 3, minor: 4, revision: 4)
 
 ext {
     fullName = 'Disruptor Framework'
@@ -32,6 +32,7 @@ ext {
     teamName = 'LMAX Disruptor Development Team'
     siteUrl = 'http://lmax-exchange.github.com/disruptor'
     sourceUrl = 'git at github.com:LMAX-Exchange/disruptor.git'
+    moduleName = 'com.lmax.disruptor'
 
     javaCompilerExecutable = System.env['JAVA_HOME'] ? System.env['JAVA_HOME'] + '/bin/javac' : 'javac'
 
@@ -99,7 +100,8 @@ jar {
                         'Bundle-Name': fullName,
                         'Bundle-Vendor': teamName,
                         'Bundle-Description': fullDescription,
-                        'Bundle-DocURL': siteUrl)
+                        'Bundle-DocURL': siteUrl,
+                        'Automatic-Module-Name': moduleName)
 }
 
 task sourcesJar(type: Jar) {


=====================================
src/main/java/com/lmax/disruptor/BatchEventProcessor.java
=====================================
@@ -35,7 +35,7 @@ public final class BatchEventProcessor<T>
     private static final int RUNNING = HALTED + 1;
 
     private final AtomicInteger running = new AtomicInteger(IDLE);
-    private ExceptionHandler<? super T> exceptionHandler = new FatalExceptionHandler();
+    private ExceptionHandler<? super T> exceptionHandler;
     private final DataProvider<T> dataProvider;
     private final SequenceBarrier sequenceBarrier;
     private final EventHandler<? super T> eventHandler;
@@ -184,7 +184,7 @@ public final class BatchEventProcessor<T>
             }
             catch (final Throwable ex)
             {
-                exceptionHandler.handleEventException(ex, nextSequence, event);
+                handleEventException(ex, nextSequence, event);
                 sequence.set(nextSequence);
                 nextSequence++;
             }
@@ -208,7 +208,7 @@ public final class BatchEventProcessor<T>
         }
         catch (Throwable e)
         {
-            exceptionHandler.handleEventException(e, availableSequence, null);
+            handleEventException(e, availableSequence, null);
         }
     }
 
@@ -225,7 +225,7 @@ public final class BatchEventProcessor<T>
             }
             catch (final Throwable ex)
             {
-                exceptionHandler.handleOnStartException(ex);
+                handleOnStartException(ex);
             }
         }
     }
@@ -243,8 +243,45 @@ public final class BatchEventProcessor<T>
             }
             catch (final Throwable ex)
             {
-                exceptionHandler.handleOnShutdownException(ex);
+                handleOnShutdownException(ex);
             }
         }
     }
+
+    /**
+     * Delegate to {@link ExceptionHandler#handleEventException(Throwable, long, Object)} on the delegate or
+     * the default {@link ExceptionHandler} if one has not been configured.
+     */
+    private void handleEventException(final Throwable ex, final long sequence, final T event)
+    {
+        getExceptionHandler().handleEventException(ex, sequence, event);
+    }
+
+    /**
+     * Delegate to {@link ExceptionHandler#handleOnStartException(Throwable)} on the delegate or
+     * the default {@link ExceptionHandler} if one has not been configured.
+     */
+    private void handleOnStartException(final Throwable ex)
+    {
+        getExceptionHandler().handleOnStartException(ex);
+    }
+
+    /**
+     * Delegate to {@link ExceptionHandler#handleOnShutdownException(Throwable)} on the delegate or
+     * the default {@link ExceptionHandler} if one has not been configured.
+     */
+    private void handleOnShutdownException(final Throwable ex)
+    {
+        getExceptionHandler().handleOnShutdownException(ex);
+    }
+
+    private ExceptionHandler<? super T> getExceptionHandler()
+    {
+        ExceptionHandler<? super T> handler = exceptionHandler;
+        if (handler == null)
+        {
+            return ExceptionHandlers.defaultHandler();
+        }
+        return handler;
+    }
 }
\ No newline at end of file


=====================================
src/main/java/com/lmax/disruptor/ExceptionHandlers.java
=====================================
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 LMAX Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.lmax.disruptor;
+
+/** Provides static methods for accessing a default {@link ExceptionHandler} object. */
+public final class ExceptionHandlers
+{
+
+    /**
+     * Get a reference to the default {@link ExceptionHandler} instance.
+     *
+     * @return a reference to the default {@link ExceptionHandler} instance
+     */
+    public static ExceptionHandler<Object> defaultHandler()
+    {
+        return DefaultExceptionHandlerHolder.HANDLER;
+    }
+
+    private ExceptionHandlers()
+    {
+    }
+
+    // lazily initialize the default exception handler.
+    // This nested object isn't strictly necessary unless additional utility functionality is
+    // added to ExceptionHandlers, but it exists to ensure the code remains obvious.
+    private static final class DefaultExceptionHandlerHolder
+    {
+        private static final ExceptionHandler<Object> HANDLER = new FatalExceptionHandler();
+    }
+}


=====================================
src/main/java/com/lmax/disruptor/dsl/ExceptionHandlerWrapper.java
=====================================
@@ -1,11 +1,11 @@
 package com.lmax.disruptor.dsl;
 
 import com.lmax.disruptor.ExceptionHandler;
-import com.lmax.disruptor.FatalExceptionHandler;
+import com.lmax.disruptor.ExceptionHandlers;
 
 public class ExceptionHandlerWrapper<T> implements ExceptionHandler<T>
 {
-    private ExceptionHandler<? super T> delegate = new FatalExceptionHandler();
+    private ExceptionHandler<? super T> delegate;
 
     public void switchTo(final ExceptionHandler<? super T> exceptionHandler)
     {
@@ -15,18 +15,28 @@ public class ExceptionHandlerWrapper<T> implements ExceptionHandler<T>
     @Override
     public void handleEventException(final Throwable ex, final long sequence, final T event)
     {
-        delegate.handleEventException(ex, sequence, event);
+        getExceptionHandler().handleEventException(ex, sequence, event);
     }
 
     @Override
     public void handleOnStartException(final Throwable ex)
     {
-        delegate.handleOnStartException(ex);
+        getExceptionHandler().handleOnStartException(ex);
     }
 
     @Override
     public void handleOnShutdownException(final Throwable ex)
     {
-        delegate.handleOnShutdownException(ex);
+        getExceptionHandler() .handleOnShutdownException(ex);
+    }
+
+    private ExceptionHandler<? super T> getExceptionHandler()
+    {
+        ExceptionHandler<? super T> handler = delegate;
+        if (handler == null)
+        {
+            return ExceptionHandlers.defaultHandler();
+        }
+        return handler;
     }
 }



View it on GitLab: https://salsa.debian.org/java-team/disruptor/-/commit/783177b6de9e1b9874a620ab75696cdbd39511a5

-- 
View it on GitLab: https://salsa.debian.org/java-team/disruptor/-/commit/783177b6de9e1b9874a620ab75696cdbd39511a5
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20210815/c93cc744/attachment.htm>


More information about the pkg-java-commits mailing list