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

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.



×
×
  • Create New...