@@ -128,22 +128,23 @@ def self.validate_argc(obj, method, *args)
128128
129129 # @!visibility private
130130 def self . included ( base )
131+ base . singleton_class . send ( :alias_method , :original_new , :new )
132+ base . send ( :private_class_method , :original_new )
131133 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 )
140134 super ( base )
141135 end
142136
143137 # @!visibility private
144138 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+
145146 def create ( *args , &block )
146- obj = self . send ( :new , *args , &block )
147+ obj = original_new ( *args , &block )
147148 obj . send ( :init_synchronization )
148149 obj
149150 end
@@ -269,6 +270,22 @@ def executor=(executor)
269270 raise ArgumentError . new ( 'executor has already been set' )
270271 end
271272
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+
272289 private
273290
274291 # Initialize the internal serializer and other stnchronization mechanisms.
0 commit comments