Jump to content

Recommended Posts

Posted

Ok i have a question that bother me 5 seconds now

 

Let's say we make a class and this class just do something 


public class Spammer
    final L2PcInstance _player;
int index = 0;
 
    Spammer(L2PcInstance player)
{
 _player = player;
start();
}
 
    public void start()
{
ThreadPoolManager.scheduleFixedRate(new Runnable()
{
@Override
public void Run()
{
  if (index == 5)
  {
_player.sendMessage("hi");
index++;
  }
  else
  _threadpool.cancel(true);
}
 
}, 1000, 1000);
}
​}

The code is really to explain you.

 

So let's say we do   new Spammer(player); 

this will start the threadpool and after 6 times it will stop send player a message. 

 

But what java do afterwards? What happen to this class created as new object ? It get fucked up garbage collector since its not doing anything ? 

 

I did a code that basically create a new object for vote but i was wondering after the time expire and give reward or no give reward what happen to this class? 

 

Thanks

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock