Skip to content

Commit

Permalink
ftpclient: use lambdas
Browse files Browse the repository at this point in the history
Motivation:

Use lambdas for shorter, easier to read code.

Modification:

Convert some anonymous inner classes to their equivalent lambda expressions.

Result:

No user or admin observable affect; code-base may be easier to maintain.

Target: master
Require-notes: no
Require-book: no
Patch: https://rb.dcache.org/r/10565/
Acked-by: Albert Rossi
  • Loading branch information
paulmillar committed Oct 23, 2017
1 parent 7adf2a0 commit dd8c44d
Showing 1 changed file with 12 additions and 17 deletions.
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2006 University of Chicago
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -114,18 +114,13 @@ protected void transferAbort()
private void closeOutgoingSockets() throws ClientException
{

SocketOperator op = new SocketOperator()
{
@Override
public void operate(SocketBox sb) throws Exception
{
if (((ManagedSocketBox) sb).isReusable()) {
Socket s = sb.getSocket();
if (s != null) {
// write the closing Eblock and close the socket
EBlockImageDCWriter.close(
new DataOutputStream(s.getOutputStream()));
}
SocketOperator op = (sb) -> {
if (((ManagedSocketBox) sb).isReusable()) {
Socket s = sb.getSocket();
if (s != null) {
// write the closing Eblock and close the socket
EBlockImageDCWriter.close(
new DataOutputStream(s.getOutputStream()));
}
}
};
Expand Down Expand Up @@ -280,7 +275,7 @@ public void store(DataSink sink)
} else if (
session.serverMode != GridFTPSession.SERVER_EPAS
&& session.serverMode != GridFTPSession.SERVER_PASSIVE) {
//
//
// EBLOCK, local server not passive
//
exceptionToControlChannel(
Expand Down Expand Up @@ -405,7 +400,7 @@ public void retrieve(DataSource source)

} else if (session.serverMode == GridFTPSession.SERVER_EACT) {

//
//
// EBLOCK, striping
//

Expand Down

0 comments on commit dd8c44d

Please sign in to comment.