Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I need to delete files in the background service after a certain time, is it possible to implement this and in what way?
You can try WorkManager. It will delete your file...
Question is pretty vague. Please be specific on which OS you want to this, any specific technology, particular environment... queue of questions on your questions i so endless.
Though to answer at high level:
Solution 1: If windows / Linux, you can write a batch / shell script which you can mark into Windows scheduler / Linux cron job. Batch will have all logic to what to delete from which path, any specific file or starting with etc. scheduler / cron job will decide at what time you want to do this. For this timeline you need to check syntax and for both OS its different. Simple search and you will get everything.
Solution 2: If you want o do it by code, you can write a Spring scheduler code (this can be in any language, but as Java developer, I will prefer this) which will interact with file system and perform file deletion for you after particular interval. For this you may need an application server to deploy.
If application server is available on machine then this will be easy job for you, or else easiest thing to do is Solution 1.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I hope that someone can help me with my problem. I am quite new to stuff like Git, Spring Boot and in general Java (Maven Projects). But i want to try to modernize our archiving system for our PL/SQL scripts. Right now, we archive them by hand and zip a version with the old date to then reserv it, that no other developer can make changes at the same time. After finishing working on the script, the developer releases the script in a specific folder (release) where it gets tested. After a successful test, other developer can now finally work on the script again.
Now, i wanna try and modernize this whole procedure:
I wanna import all our PL/SQL scripts into GitLab
If some developer is working on a script and commits/pushes it, i want that a action happens, where the script gets also copied into our release-directory, where it can be tested from our consultant (in context of the specific ticket the script gets released to)
I dont excactly know if my thought fits in here but i think it would fit the modernizing concept, if a new branch would be used for this (developer/testing branch). So that after a period of 2 weeks (our scrum sprint) all changes could get merged into the master branch
I would like to know, what is the best way to realize this and how would i go forward. Because i dont know if my idea with GitLab + Spring Boot Application is the best in this scenario and even if it is, how do i manage to monitor that. Its the starting point that i am missing. Once its there i think i can handle everything but the beginning is my problem (and missing examples).
I am sorry in advance for my bad english and hope you can help me getting started with my idea :)
Thx
Steven
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Due to some policy constraint at our company, we cannot use any external Library. I couldn't find any way to do that in Java.
I can think of two ways to avoid using an external library:
Implement your own SSH File Transfer Protocol client using the standard SSLSocket class ad related classes. The specifications are linked from the Wikipedia page. A brief review of the spec suggests that the protocol is not that complicated.
Identify and install a command-line client for SFTP, then use Process and ProcessBuilder to run the client as an external process.
Before you undertake any significant coding work on this, I would advise you to estimate how much dev time it will take to code test and maintain the code. If it seems like a lot, document the estimates and take them to your line manager.
If you are faced with a significant amount of extra work, it may affect your ability to meet your deadlines. Your manager needs to know about that.
If your manager is faced with a large dev cost or schedule slippage, he or she may be prepared to argue for an exemption to this (IMO) crazy corporate policy.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to run my Java selenium script every one hour.I want to do it without Human intervention.How to do it?
Can i do it by keeping my piece of code in cloud or any online IDE which runs it every one hour?
Please help in this case.
I have seen some people suggesting Windows Task scheduler,but the file should run even my computer is shutdown.
Windows scheduled task. https://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspx
Cron job https://www.digitalocean.com/community/tutorials/how-to-schedule-routine-tasks-with-cron-and-anacron-on-a-vps
I would use something like Jenkins, or AWS to run your job (on a schedule).
You can create tests packed as an executable the easiest way may be to run a CRON job or a Windows scheduled task.
Or
If you have Hudson (or another continuous integration system like jenkin ) can be use for it and is almost certainly better long term strategies.
However this question is quite broad, I can give you a general approach with a suggestion. That you need is to persist the application where is the script, method or whatsoever included and call it every 60 minutes.
In general, I'd suggest you create a web service and deploy it on Azure's Tomcat servlet container. You need a web page available online, where you can periodically call with AJAX the Selenium method mapped to the exact URL.
The disadvantage may be the complexity of the client-side and server-side concept if you have the lack of experience. However, you can monitor the activity and the results for your own and scale the web service.
You can use any only CI environments for this task. For example free and easy to configure is travis-ci it has integration with github and lot of documentation for how to run it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am beginning to write a basic "study-buddy" program as a side project. One important feature I want to implement is that the program can access the state of other programs running to prevent you from accessing them / yell at you. For instance, if you had Chrome open to Facebook, or if you launched a video game.
First off, is this even possible/reasonable to accomplish in Java? Second, specifically with Chrome, how can I access the programs state from another program that I am writing? More generally, how can I access ALL programs running on the computer and check to see whether anything violates "study-permissible" programs?
I would put this as a comment, but my reputation point is not enough.
One way is using the commands the operating system provides. You can run a command with
Runtime.getRuntime().exec("<command name>");
This will give you the related process and you can get the output of that process just as manually running the process. Then, you can utilize the output.
Basically if the OS provides you that information manually, you should be able to get the information within Java.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How would you add system recovery in a multi-threaded environment? For eg: if you have a system where multiple threads pickup files and process them and persist them in database, how would the system recover if there is a database failure you
dont want to process the trades again?
There are many different ways to answer this question depending on your system setup. A little bit more of an explanation would help. I have still provided an example that could possibly work for you though.
I would probably look at a way to mark a file as in process (i.e. database record or moving to a different directory to process the file). Then I would mark the file as finished when it processed (moving it or doing it some other way).
There is a still a possibility of failure after finish processing and marking the file as finished. However, this would limit the amount of files you need to look at for recovery.
If you can keep track of what files were read in the same database you can batch all your databases changes as well as the flag to mark the file as read. You can avoid committing the connection until your have done the changes and flagged the file.
This also has an issue of if the database crashes mid commit, but at the same time you would probably have to restore a backup in this instance and rerun all the files again.