Jump to content

Reloading Jar Files In Real Time


Recommended Posts

There is a very cool software that i use, it is called JRebel(http://zeroturnaround.com/software/jrebel/).
 
What can it do?
You can reload any piece of code, without need to restart the server.
Let's say you created quite a large code, but simple error doesnt allow you to test it. Normally you would need to:
1. Fix the error
2. Compile fixes(3 seconds. If you are wondering how i compile my whole source code in 3 seconds, look below)
3. Close the Server(Lets say 2 seconds)
4. Create the Jars and paste them(3 seconds)
5. Start the server again(33 seconds)
6. Login(10 seconds)
7. Test
So totally it takes 51 seconds from fixing to next testing
 
With JRebel you need to:
1. Fix the error
2. Compile fixes(3 seconds)
3. Create the Jars and paste them(3 seconds)
4. Test
With JRebel it takes 6 seconds.
 
How long it takes to start the server with JRebel?
JRebel: 83 seconds
NO JRebel: 33 seconds
So that's big disadventage. If you are working on the code that runs at start of the server, its worth to disable the JRebel(it's very easy to disable it).
 
How applying the changes looks like?
1. Fix the error/make the improvement/add something new:
z8NW7AW.png
 
2. Compile changed classes
HCKW9lH.png

3. Build the Jars and paste them(I have got build file which automatically pastes my jars)
QmheC8p.png
 
When class is used by JVM, you will see the message that it was updated
rhGhrxl.png
 
4. Test
rlsSujE.png
 
How to install JRebel?
1. Get Trial(Don't worry about 2 weeks, it's very easy to crack or you can just buy it)
https://zeroturnaround.com/software/jrebel/download/
 
2. Activate it on your pc
- Intellij IDEA - https://zeroturnaround.com/software/jrebel/quickstart/intellij/#!/activation
- Eclipse - https://zeroturnaround.com/software/jrebel/quickstart/eclipse/#!/activation
 
3. Download JRebel.jar
https://zeroturnaround.com/software/jrebel/download/thank-you/?file=jrebel-6.1.3-nosetup.zip
 
4. Paste JRebel.jar near StartGameServer.bat
 
5. Put -javaagent:jrebel.jar just after java in StartGameServer.bat
5cxXKEO.png
 
6. You need to create jrebel folder near StartGameServer.bat and
- Add there jars that you want to be reloadable. I am adding just gameserver + scripts + commons
- So you will need to have those 3 jars in 2 locations: your libs + jrebel folder
- While launching the gameserver, remember that jars in jrebel must be exactly the same as your jars in libs, or JRebel will not work fine
zcscr1I.png
 
7. You need to create jrebel.xml, add it into your configs file
- Thats how my jrebel.xml looks like: http://pastebin.com/hNzjDE6R
- You should edit jarset dir, to link to your jrebel folder
 
8. Launch the gameserver. You should see something like this
I2Dj2sz.png
 
How to compile my changes so fast?
- I am compiling just classes that were modified lately, not the whole source
- I have got Build file which copies created jar to my libs + jrebel folder
 
So for the first time i click Build > Rebuild Project in Intellij IDEA(i don't know about eclipse). It takes a while but after that i can use Compile 'Player.java' or Make Project which compiles just changes files
The Compile files are put to "C:\Users\Michal\IdeaProjects\L2Tales\out\production\L2Tales"
My Build file: http://pastebin.com/MbkCBBVh

Link to comment
Share on other sites

It's obviously a tool to develop, not a thing to keep on a live installation (just saying about your loading statement).

I didn't test it on live server, but i think it wouldn't work well because:

1. Longer start up time as you said

2. Most likely lower performance would cause lags

3. Reloading larger classes would be felt by players in game

 

For development, its great :)

Link to comment
Share on other sites

I didn't test it on live server, but i think it wouldn't work well because:

1. Longer start up time as you said

2. Most likely lower performance would cause lags

3. Reloading larger classes would be felt by players in game

 

For development, its great :)

 

why dont u run ur server from the Eclipse then? I can't get it. I develop my servers from eclipse while its online, I edit code on the fly and the changes happen runtime..

Link to comment
Share on other sites

why dont u run ur server from the Eclipse then? I can't get it. I develop my servers from eclipse while its online, I edit code on the fly and the changes happen runtime..

i play on your server and when you fix something you make a restart , but well its a nice tool for the outdoors

Link to comment
Share on other sites

why dont u run ur server from the Eclipse then? I can't get it. I develop my servers from eclipse while its online, I edit code on the fly and the changes happen runtime..

I think you might be talking about HotSwap. You can see the differences in here: http://zeroturnaround.com/software/jrebel/features/

Link to comment
Share on other sites

i play on your server and when you fix something you make a restart , but well its a nice tool for the outdoors

 

I said I develop, thats how I coded L2AEPvP back when I was developing it. Now its live and obviusly its not running in Eclipse..

 

 

I think you might be talking about HotSwap. You can see the differences in here: http://zeroturnaround.com/software/jrebel/features/

 
Im talking about Eclipse Debug that works like all Debug tools, you can even edit native C++ during runtime with good debugers..
Edited by xxdem
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • chrome and ISP doesn't let me due to ssl errors in your website
    • Keto Move ||  https://rebrand.ly/keto-move-official   Keto Move, as the name the provider has given it, is a pragmatic and regular arrangement that will help you in consuming the additional fat that is all put away in different substantial segments of your body. It can help you through your weight reduction venture in each conceivable way and assist you with consuming off every one of the additional calories put away in your headstrong body districts. On a keto diet, you should comply to specific tight rules, for example, consuming only 5% of carbs, considerably less than whatever we ordinarily take.   Facebook:- https://www.facebook.com/Keto.Move.Official/   Keto Move targets obstinate fat stores all through your body and attempts to kill them, permitting you to get thinner. This keto supplement contains BHB salts, green tea remove, espresso separate, and other home grown parts. Each part of this recipe ensures that Ketosis works appropriately in the body. What's more, this adds to fruitful weight reduction. These sticky bears offer your body all it expects for appropriate cell action. These desserts taste better, yet they additionally work better.   More Relative Blogs https://keto-move.webflow.io/ https://keto-move.company.site/ https://keto-move.jimdosite.com/ https://keto-move.mystrikingly.com/ https://ketomove.journoportfolio.com/ https://solo.to/ketomove https://bio.link/ketomoveofficial https://in.pinterest.com/pin/1145532855383041696 https://soundcloud.com/ketomove/keto-move-weight-loss-review-price-benefits https://medium.com/@ketomove/keto-move-expert-tips-for-staying-on-track-with-keto-71933c4ceaa5 https://sketchfab.com/3d-models/keto-move-better-sale-price-2024-54158d06ed6b48a485ec4ae5568792d9 https://www.eventbrite.com/e/keto-move-keto-move-updated-customer-warning-alert-exposed-tickets-891768873707
    • Attention, attention, the heroes of Elmoraden are wanted! Get ready for new adventures, because our gates are open for you! We switch to the Interlude chronicles on Lionna x5 server, where exciting battles, exciting quests and incredible adventures await you! But that's not all! For beginners, we have a special offer – shadow equipment that will help you develop faster and more efficiently in the world of Elmoraden. With these powerful items, you can easily reach new heights! Join us on May 17th and become a part of the great saga! An unforgettable adventure awaits you on the Lionna X5 server with the Interlude chronicles. Don't miss your chance to become a real hero!     More info: - Characters created from 17.05 09:00 server time, when created will receive gifts in the form of chests with coupons for temporary weapons \ armor No Grade - A grade; - Characters created from 15.05 00:00 server time to 17.05 09:00 will receive gifts in the form of chests with coupons for temporary weapons \ armor No Grade - A grade; - Gifts are divided by grades (No Grade - A Grade) and gifts can be opened at levels corresponding to the grade of the gift. (A gift of D Grade can be opened at the 20th level, B Grade at 52, etc.), but the character's level when opening the gift should not exceed the 75th; - The duration of the equipment \ weapon is 10 hours; - Chaotic characters (characters whose PK counter is higher than 0) cannot use shadow equipment; - On 17.05 at 09:00 server time (10:00 Moscow time), you can meet Looney the Cat in the cities, who will exchange coupons for temporary weapons and equipment; Coupon amount in the gift chests: No Grade: 1 D Grade: 2 C Grade: 2 B Grade: 1 A Grade: 1   On 17.06 at 00:00 server time, the cats will disappear, and with them the chests and coupons. Items received for coupons are not deleted.
  • Topics

×
×
  • Create New...