@@ -145,37 +145,36 @@ public void openAsync(final SingleResultCallback<Void> callback) {
145
145
isTrue ("Open already called" , stream == null , callback );
146
146
try {
147
147
stream = streamFactory .create (serverId .getAddress ());
148
- } catch (Throwable t ) {
149
- callback .onResult (null , t );
150
- return ;
151
- }
152
- stream .openAsync (new AsyncCompletionHandler <Void >() {
153
- @ Override
154
- public void completed (final Void aVoid ) {
155
- connectionInitializer .initializeAsync (InternalStreamConnection .this , new SingleResultCallback <ConnectionDescription >() {
156
- @ Override
157
- public void onResult (final ConnectionDescription result , final Throwable t ) {
158
- if (t != null ) {
159
- close ();
160
- callback .onResult (null , t );
161
- } else {
162
- description = result ;
163
- opened .set (true );
164
- sendCompressor = findSendCompressor (description );
165
- if (LOGGER .isInfoEnabled ()) {
166
- LOGGER .info (format ("Opened connection [%s] to %s" , getId (), serverId .getAddress ()));
148
+ stream .openAsync (new AsyncCompletionHandler <Void >() {
149
+ @ Override
150
+ public void completed (final Void aVoid ) {
151
+ connectionInitializer .initializeAsync (InternalStreamConnection .this , new SingleResultCallback <ConnectionDescription >() {
152
+ @ Override
153
+ public void onResult (final ConnectionDescription result , final Throwable t ) {
154
+ if (t != null ) {
155
+ close ();
156
+ callback .onResult (null , t );
157
+ } else {
158
+ description = result ;
159
+ opened .set (true );
160
+ sendCompressor = findSendCompressor (description );
161
+ if (LOGGER .isInfoEnabled ()) {
162
+ LOGGER .info (format ("Opened connection [%s] to %s" , getId (), serverId .getAddress ()));
163
+ }
164
+ callback .onResult (null , null );
167
165
}
168
- callback .onResult (null , null );
169
166
}
170
- }
171
- });
172
- }
167
+ });
168
+ }
173
169
174
- @ Override
175
- public void failed (final Throwable t ) {
176
- callback .onResult (null , t );
177
- }
178
- });
170
+ @ Override
171
+ public void failed (final Throwable t ) {
172
+ callback .onResult (null , t );
173
+ }
174
+ });
175
+ } catch (Throwable t ) {
176
+ callback .onResult (null , t );
177
+ }
179
178
}
180
179
181
180
private Map <Byte , Compressor > createCompressorMap (final List <MongoCompressor > compressorList ) {
0 commit comments