@ -119,18 +119,17 @@ class WriteResultPublisher implements Publisher<Void> {
@Override
@Override
void subscribe ( WriteResultPublisher publisher , Subscriber < ? super Void > subscriber ) {
void subscribe ( WriteResultPublisher publisher , Subscriber < ? super Void > subscriber ) {
Assert . notNull ( subscriber , "Subscriber must not be null" ) ;
Assert . notNull ( subscriber , "Subscriber must not be null" ) ;
publisher . subscriber = subscriber ;
if ( publisher . changeState ( this , SUBSCRIBING ) ) {
if ( publisher . changeState ( this , SUBSCRIBED ) ) {
Subscription subscription = new ResponseBodyWriteResultSubscription ( publisher ) ;
Subscription subscription = new ResponseBodyWriteResultSubscription ( publisher ) ;
publisher . subscriber = subscriber ;
subscriber . onSubscribe ( subscription ) ;
subscriber . onSubscribe ( subscription ) ;
publisher . changeState ( SUBSCRIBING , SUBSCRIBED ) ;
if ( publisher . publisherCompleted ) {
if ( publisher . publisherCompleted ) {
publisher . publishComplete ( ) ;
publisher . publishComplete ( ) ;
}
}
else {
Throwable publisherError = publisher . publisherError ;
Throwable publisherError = publisher . publisherError ;
if ( publisherError ! = null ) {
if ( publisherError ! = null ) {
publisher . publishError ( publisherError ) ;
publisher . publishError ( publisherError ) ;
}
}
}
}
}
else {
else {
@ -147,6 +146,21 @@ class WriteResultPublisher implements Publisher<Void> {
}
}
} ,
} ,
SUBSCRIBING {
@Override
void request ( WriteResultPublisher publisher , long n ) {
Operators . validate ( n ) ;
}
@Override
void publishComplete ( WriteResultPublisher publisher ) {
publisher . publisherCompleted = true ;
}
@Override
void publishError ( WriteResultPublisher publisher , Throwable t ) {
publisher . publisherError = t ;
}
} ,
SUBSCRIBED {
SUBSCRIBED {
@Override
@Override
void request ( WriteResultPublisher publisher , long n ) {
void request ( WriteResultPublisher publisher , long n ) {
@ -183,14 +197,6 @@ class WriteResultPublisher implements Publisher<Void> {
void cancel ( WriteResultPublisher publisher ) {
void cancel ( WriteResultPublisher publisher ) {
// ignore
// ignore
}
}
@Override
void publishComplete ( WriteResultPublisher publisher ) {
// ignore
}
@Override
void publishError ( WriteResultPublisher publisher , Throwable t ) {
// ignore
}
} ;
} ;
void subscribe ( WriteResultPublisher publisher , Subscriber < ? super Void > subscriber ) {
void subscribe ( WriteResultPublisher publisher , Subscriber < ? super Void > subscriber ) {
@ -208,11 +214,11 @@ class WriteResultPublisher implements Publisher<Void> {
}
}
void publishComplete ( WriteResultPublisher publisher ) {
void publishComplete ( WriteResultPublisher publisher ) {
throw new IllegalStateException ( toString ( ) ) ;
// ignore
}
}
void publishError ( WriteResultPublisher publisher , Throwable t ) {
void publishError ( WriteResultPublisher publisher , Throwable t ) {
throw new IllegalStateException ( toString ( ) ) ;
// ignore
}
}
}
}