Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.6k views
in Java FTP by (120 points)
Hi,

one of my application uses the java timer class and ftp files in a remote server after each interval. in each interval , i create a new ftp object (same name object)to connect to the remote server.

suppose i am transferring files to the server and at that time, the next interval time occurs. This new interval will create a new ftp object with the same object name.

i have synchronized the code block over the ftp object so that the put method can't be called samultaneously.

[i][b]will it be ok and thread-safe? [/b][/i]

please reply.

1 Answer

0 votes
by (162k points)
FTPClient is not synch, but what you suggest could cause problems if you are deleting/recreating the object you are synched on. Best to synch on a different object altogether perhaps.

Hi,

one of my application uses the java timer class and ftp files in a remote server after each interval. in each interval , i create a new ftp object (same name object)to connect to the remote server.

suppose i am transferring files to the server and at that time, the next interval time occurs. This new interval will create a new ftp object with the same object name.

i have synchronized the code block over the ftp object so that the put method can't be called samultaneously.

will it be ok and thread-safe?

please reply.

Categories

...