This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new be649d5  catch UnsatisfiedLinkError in WindowsTimer
be649d5 is described below

commit be649d5d5437a99be225049f94fda058e4b9e896
Author: Stephen L. De Rudder <[email protected]>
AuthorDate: Tue Sep 14 21:21:05 2021 -0500

    catch UnsatisfiedLinkError in WindowsTimer
    
    Patch by Stephen L. De Rudder; reviewed by brandonwilliams and jmckenzie
    for CASSANDRA-16085
---
 CHANGES.txt                                           |  1 +
 src/java/org/apache/cassandra/utils/WindowsTimer.java | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index bf17d9a..94340d8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.26:
+ * Catch UnsatisfiedLinkError in WindowsTimer (CASSANDRA-16085)
  * Avoid removing batch when it's not created during view replication 
(CASSANDRA-16175)
  * Make the addition of regular column to COMPACT tables throw an 
InvalidRequestException (CASSANDRA-14564)
  * Fix materialized view schema backup as table (CASSANDRA-12734)
diff --git a/src/java/org/apache/cassandra/utils/WindowsTimer.java 
b/src/java/org/apache/cassandra/utils/WindowsTimer.java
index 351751f..f004979 100644
--- a/src/java/org/apache/cassandra/utils/WindowsTimer.java
+++ b/src/java/org/apache/cassandra/utils/WindowsTimer.java
@@ -27,17 +27,24 @@ import com.sun.jna.Native;
 public final class WindowsTimer
 {
     private static final Logger logger = 
LoggerFactory.getLogger(WindowsTimer.class);
+    
+    private static boolean available;
 
     static
     {
         try
         {
             Native.register("winmm");
+            available = true;
         }
         catch (NoClassDefFoundError e)
         {
             logger.warn("JNA not found. winmm.dll cannot be registered. 
Performance will be negatively impacted on this node.");
         }
+        catch (UnsatisfiedLinkError e)
+        {
+            logger.error("Failed to link the winmm.dll library against JNA. 
Performance will be negatively impacted on this node.", e);
+        }
         catch (Exception e)
         {
             logger.error("Failed to register winmm.dll. Performance will be 
negatively impacted on this node.");
@@ -54,6 +61,8 @@ public final class WindowsTimer
         if (period == 0)
             return;
         assert(period > 0);
+        if (!available)
+            return;
         if (timeBeginPeriod(period) != 0)
             logger.warn("Failed to set timer to : " + period + ". Performance 
will be degraded.");
     }
@@ -63,6 +72,8 @@ public final class WindowsTimer
         if (period == 0)
             return;
         assert(period > 0);
+        if (!available)
+            return;
         if (timeEndPeriod(period) != 0)
             logger.warn("Failed to end accelerated timer period. System timer 
will remain set to: " + period + " ms.");
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to