Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpc-workflow-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIJI
hpc-workflow-manager
Commits
079ddc4f
Commit
079ddc4f
authored
7 years ago
by
Jan Kožusznik
Browse files
Options
Downloads
Patches
Plain Diff
code: remove verbose logs
parent
cbfb13c4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/MidlewareTunnel.java
+27
-34
27 additions, 34 deletions
...n/java/cz/it4i/fiji/haas_java_client/MidlewareTunnel.java
with
27 additions
and
34 deletions
haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/MidlewareTunnel.java
+
27
−
34
View file @
079ddc4f
...
...
@@ -28,7 +28,6 @@ public class MidlewareTunnel implements Closeable {
private
Thread
thread
;
private
final
String
ipAddress
;
private
final
String
sessionCode
;
public
MidlewareTunnel
(
long
jobId
,
String
hostIp
,
String
sessionCode
)
{
this
.
jobId
=
jobId
;
...
...
@@ -42,23 +41,22 @@ public class MidlewareTunnel implements Closeable {
public
void
open
(
int
port
)
throws
UnknownHostException
,
IOException
{
ss
=
new
ServerSocket
(
0
,
50
,
InetAddress
.
getByName
(
"localhost"
));
ss
.
setSoTimeout
(
TIMEOUT
);
thread
=
new
Thread
()
{
thread
=
new
Thread
()
{
@Override
public
void
run
()
{
while
(!
Thread
.
interrupted
()
&&
!
ss
.
isClosed
())
{
try
(
Socket
soc
=
ss
.
accept
())
{
while
(!
Thread
.
interrupted
()
&&
!
ss
.
isClosed
())
{
try
(
Socket
soc
=
ss
.
accept
())
{
doTransfer
(
soc
);
}
catch
(
SocketTimeoutException
e
)
{
//ignore and check interruption
}
catch
(
IOException
e
)
{
//
ignore and check interruption
}
catch
(
IOException
e
)
{
TestCommunicationWithNodes
.
log
.
error
(
e
.
getMessage
(),
e
);
break
;
}
}
}
}
private
void
doTransfer
(
Socket
soc
)
{
...
...
@@ -76,14 +74,14 @@ public class MidlewareTunnel implements Closeable {
TestCommunicationWithNodes
.
log
.
info
(
"endDataTransfer"
);
dataTransfer
.
endDataTransfer
(
transfer
,
sessionCode
);
TestCommunicationWithNodes
.
log
.
info
(
"endDataTransfer - DONE"
);
helpingThread
.
interrupt
();
try
{
helpingThread
.
join
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
}
TestCommunicationWithNodes
.
log
.
info
(
"END: doTransfer"
);
}
};
...
...
@@ -99,7 +97,7 @@ public class MidlewareTunnel implements Closeable {
Thread
.
currentThread
().
interrupt
();
TestCommunicationWithNodes
.
log
.
error
(
e
.
getMessage
(),
e
);
}
if
(
ss
!=
null
)
{
if
(
ss
!=
null
)
{
ss
.
close
();
ss
=
null
;
}
...
...
@@ -111,60 +109,55 @@ public class MidlewareTunnel implements Closeable {
private
void
sendToMiddleware
(
Socket
soc
)
{
TestCommunicationWithNodes
.
log
.
info
(
"START: sendToMiddleware"
);
StringBuilder
sb
=
new
StringBuilder
();
try
{
InputStream
is
=
Channels
.
newInputStream
(
Channels
.
newChannel
(
soc
.
getInputStream
()));
int
len
;
byte
[]
buffer
=
new
byte
[
4096
];
while
(!
Thread
.
interrupted
()
&&
-
1
!=
(
len
=
is
.
read
(
buffer
)))
{
byte
[]
buffer
=
new
byte
[
4096
];
while
(!
Thread
.
interrupted
()
&&
-
1
!=
(
len
=
is
.
read
(
buffer
)))
{
byte
[]
sending
;
if
(
len
==
0
)
{
if
(
len
==
0
)
{
continue
;
}
if
(
buffer
.
length
!=
len
)
{
if
(
buffer
.
length
!=
len
)
{
sending
=
new
byte
[
len
];
System
.
arraycopy
(
buffer
,
0
,
sending
,
0
,
len
);
}
else
{
sending
=
buffer
;
}
sb
.
append
(
new
String
(
sending
));
int
result
=
dataTransfer
.
sendDataToJobNode
(
sending
,
jobId
,
ipAddress
,
sessionCode
);
if
(
result
<=
0
)
{
if
(
result
<=
0
)
{
return
;
}
}
}
catch
(
InterruptedIOException
e
)
{
}
catch
(
InterruptedIOException
e
)
{
return
;
}
catch
(
SocketException
e
)
{
if
(!
e
.
getMessage
().
equals
(
"Socket closed"
))
{
}
catch
(
SocketException
e
)
{
if
(!
e
.
getMessage
().
equals
(
"Socket closed"
))
{
TestCommunicationWithNodes
.
log
.
error
(
e
.
getMessage
(),
e
);
}
}
catch
(
IOException
e
)
{
return
;
}
finally
{
TestCommunicationWithNodes
.
log
.
info
(
"sent: <"
+
sb
+
">"
);
TestCommunicationWithNodes
.
log
.
info
(
"END: sendToMiddleware"
);
}
}
private
void
readFromMiddleware
(
Socket
soc
)
{
private
void
readFromMiddleware
(
Socket
soc
)
{
TestCommunicationWithNodes
.
log
.
info
(
"START: readFromMiddleware"
);
StringBuilder
sb
=
new
StringBuilder
();
try
{
OutputStream
os
=
soc
.
getOutputStream
();
byte
[]
received
=
null
;
while
(!
Thread
.
interrupted
()
&&
null
!=
(
received
=
dataTransfer
.
readDataFromJobNode
(
jobId
,
ipAddress
,
sessionCode
)))
{
if
(
received
.
length
>
0
)
{
//logData("received",received);
byte
[]
received
=
null
;
while
(!
Thread
.
interrupted
()
&&
null
!=
(
received
=
dataTransfer
.
readDataFromJobNode
(
jobId
,
ipAddress
,
sessionCode
)))
{
if
(
received
.
length
>
0
)
{
// logData("received",received);
os
.
write
(
received
);
os
.
flush
();
sb
.
append
(
new
String
(
received
));
}
}
os
.
flush
();
}
catch
(
InterruptedIOException
e
)
{
}
catch
(
InterruptedIOException
e
)
{
return
;
}
catch
(
IOException
e
)
{
TestCommunicationWithNodes
.
log
.
error
(
e
.
getMessage
(),
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment