private FcpConnection connect() throws IOException {
FcpConnection fcpConnection = this.fcpConnection.get();
- if (fcpConnection != null) {
+ if ((fcpConnection != null) && !fcpConnection.isClosed()) {
return fcpConnection;
}
fcpConnection = createConnection();
- this.fcpConnection.compareAndSet(null, fcpConnection);
+ this.fcpConnection.set(fcpConnection);
return fcpConnection;
}
}
@Override
+ public GetConfigCommand getConfig() {
+ return new GetConfigCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public ModifyConfigCommand modifyConfig() {
+ return new ModifyConfigCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
public GenerateKeypairCommand generateKeypair() {
return new GenerateKeypairCommandImpl(threadPool, this::connect);
}
}
@Override
+ public ListPeerCommand listPeer() {
+ return new ListPeerCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
public ListPeersCommand listPeers() {
return new ListPeersCommandImpl(threadPool, this::connect);
}
+ @Override
+ public AddPeerCommand addPeer() {
+ return new AddPeerCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public ModifyPeerCommand modifyPeer() {
+ return new ModifyPeerCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public RemovePeerCommand removePeer() {
+ return new RemovePeerCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public ListPeerNotesCommand listPeerNotes() {
+ return new ListPeerNotesCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public ModifyPeerNoteCommand modifyPeerNote() {
+ return new ModifyPeerNoteCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public LoadPluginCommand loadPlugin() {
+ return new LoadPluginCommandImpl(threadPool, this::connect);
+ }
+
+ @Override
+ public ReloadPluginCommand reloadPlugin() {
+ return new ReloadPluginCommandImpl(threadPool, this::connect);
+ }
+
}