@@ -128,22 +128,23 @@ def self.validate_argc(obj, method, *args)
128
128
129
129
# @!visibility private
130
130
def self . included ( base )
131
+ base . singleton_class . send ( :alias_method , :original_new , :new )
132
+ base . send ( :private_class_method , :original_new )
131
133
base . extend ( ClassMethods )
132
- base . send ( :private_class_method , :new )
133
- super ( base )
134
- end
135
-
136
- # @!visibility private
137
- def self . extended ( base )
138
- base . extend ( ClassMethods )
139
- base . send ( :private_class_method , :new )
140
134
super ( base )
141
135
end
142
136
143
137
# @!visibility private
144
138
module ClassMethods
139
+
140
+ # @deprecated
141
+ def new ( *args , &block )
142
+ warn '[DEPRECATED] use the `create` method instead'
143
+ create ( *args , &block )
144
+ end
145
+
145
146
def create ( *args , &block )
146
- obj = self . send ( :new , *args , &block )
147
+ obj = original_new ( *args , &block )
147
148
obj . send ( :init_synchronization )
148
149
obj
149
150
end
@@ -269,6 +270,22 @@ def executor=(executor)
269
270
raise ArgumentError . new ( 'executor has already been set' )
270
271
end
271
272
273
+ # Initialize the internal serializer and other stnchronization mechanisms.
274
+ #
275
+ # @note This method *must* be called immediately upon object construction.
276
+ # This is the only way thread-safe initialization can be guaranteed.
277
+ #
278
+ # @raise [Concurrent::InitializationError] when called more than once
279
+ #
280
+ # @!visibility private
281
+ # @deprecated
282
+ def init_mutex
283
+ warn '[DEPRECATED] use the `create` method instead'
284
+ init_synchronization
285
+ rescue InitializationError
286
+ # suppress
287
+ end
288
+
272
289
private
273
290
274
291
# Initialize the internal serializer and other stnchronization mechanisms.
0 commit comments