8181586: DateTimeTextProvider.getInstance() returns a new instance every time
authornaoto
Tue, 06 Jun 2017 10:34:21 -0700
changeset 45391 60ea73fb4b4c
parent 45390 c3f2c4b3d980
child 45392 fe2cb56e7fe9
8181586: DateTimeTextProvider.getInstance() returns a new instance every time Reviewed-by: rriggs
jdk/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java	Tue Jun 06 01:33:53 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java	Tue Jun 06 10:34:21 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,9 @@
         }
     };
 
+    // Singleton instance
+    private static final DateTimeTextProvider INSTANCE = new DateTimeTextProvider();
+
     DateTimeTextProvider() {}
 
     /**
@@ -120,7 +123,7 @@
      * @return the provider, not null
      */
     static DateTimeTextProvider getInstance() {
-        return new DateTimeTextProvider();
+        return INSTANCE;
     }
 
     /**