2
2
require 'concurrent/atomic/atomic_boolean'
3
3
require 'concurrent/atomic/atomic_fixnum'
4
4
require 'concurrent/lock_free_stack'
5
- require 'concurrent/concern/logging'
6
5
require 'concurrent/errors'
7
6
8
7
module Concurrent
@@ -469,7 +468,6 @@ class AbstractEventFuture < Synchronization::Object
469
468
safe_initialization!
470
469
private ( *attr_atomic ( :internal_state ) - [ :internal_state ] )
471
470
472
- include Concern ::Logging
473
471
include InternalStates
474
472
475
473
def initialize ( promise , default_executor )
@@ -924,9 +922,7 @@ def exception(*args)
924
922
raise Concurrent ::Error , 'it is not rejected' unless rejected?
925
923
reason = internal_state . reason
926
924
if reason . is_a? ( ::Array )
927
- # TODO (pitr-ch 12-Jun-2016): remove logging!, how?
928
- reason . each { |e | log ERROR , 'Promises::Future' , e }
929
- Concurrent ::Error . new 'multiple exceptions, inspect log'
925
+ Concurrent ::MultipleErrors . new reason
930
926
else
931
927
reason . exception ( *args )
932
928
end
@@ -1119,14 +1115,9 @@ def apply(args, block)
1119
1115
1120
1116
def rejected_resolution ( raise_on_reassign , state )
1121
1117
if raise_on_reassign
1122
- # TODO (pitr-ch 12-Jun-2016): remove logging?!
1123
- # print otherwise hidden error
1124
- log ERROR , 'Promises::Future' , reason if reason
1125
- log ERROR , 'Promises::Future' , state . reason if state . reason
1126
-
1127
- raise ( Concurrent ::MultipleAssignmentError . new (
1128
- "Future can be resolved only once. Current result is #{ result } , " +
1129
- "trying to set #{ state . result } " ) )
1118
+ raise Concurrent ::MultipleAssignmentError . new (
1119
+ "Future can be resolved only once. It's #{ result } , trying to set #{ state . result } ." ,
1120
+ current_result : result , new_result : state . result )
1130
1121
end
1131
1122
return false
1132
1123
end
@@ -1257,7 +1248,6 @@ def with_hidden_resolvable
1257
1248
class AbstractPromise < Synchronization ::Object
1258
1249
safe_initialization!
1259
1250
include InternalStates
1260
- include Concern ::Logging
1261
1251
1262
1252
def initialize ( future )
1263
1253
super ( )
@@ -1282,7 +1272,7 @@ def touch
1282
1272
end
1283
1273
1284
1274
def to_s
1285
- "<# #{ self . class } :0x#{ '%x' % ( object_id << 1 ) } #{ state } >"
1275
+ format '<#%s :0x%x %s>' , self . class , object_id << 1 , state
1286
1276
end
1287
1277
1288
1278
def inspect
@@ -1298,11 +1288,8 @@ def resolve_with(new_state, raise_on_reassign = true)
1298
1288
# @return [Future]
1299
1289
def evaluate_to ( *args , block )
1300
1290
resolve_with Fulfilled . new ( block . call ( *args ) )
1301
- rescue StandardError => error
1302
- resolve_with Rejected . new ( error )
1291
+ # TODO (pitr-ch 30-Jul-2016): figure out what should be rescued, there is an issue about it
1303
1292
rescue Exception => error
1304
- # TODO (pitr-ch 12-Jun-2016): remove logging?
1305
- log ( ERROR , 'Promises::Future' , error )
1306
1293
resolve_with Rejected . new ( error )
1307
1294
end
1308
1295
end
0 commit comments