Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Archive log file size

763212Apr 20 2010 — edited Apr 20 2010
Redlogfile size is 16 Mb and generating archivelog file size is around 10Mb. what could be the reason?

Oracle Version: 10.2.0.4

OS : Windows

Edited by: Deccan Charger on Apr 19, 2010 11:31 PM
This post has been answered by Chinar on Apr 20 2010
Jump to Answer

Comments

807589
Since you're looking at the key code of a KeyEvent, I'll assume you're in a key pressed event handle method. This method is called by the Event Dispatch Thread (EDT). Calls to paint are also done on the EDT, so repaint has no effect until after this method ends. So the calls to Thread.sleep() cause your whole application to freeze. Want you want to do is create a swing Timer that you can use to update your stick figure every 200 milliseconds. You then stop the timer when you've updated the figures position 11 times.
807589
Perhaps another way to do this is to have you're repaint and algo statment in a class that extends thread, and start that thread from your program
switch(e.getKeyCode()){
case KeyEvent.VK_UP:
Runner run = new Runner(component_you_want_to_repaint);
run.start();
break;
}
Then you have your thread class, and you use the SwingUtilities.invoke later to repaint your screen and the sleep() method to sleep the thread
public class Runner extends Thread{
Component comp;
public Runner(Component c){
comp = c;
}
public void run(){

				for(int i=0; i<=10; i=i+1){
					y = y+1;  //the int y represents the images position of the y-axis
                                                        Runnable doLater = new Runnable(){
                                                         public void run(){
                                                         comp.repaint(); 
                                                         }
                                                       };
							SwingUtilities.invokeLater( doLater );
					sleep(200);
						
					if(i == 10){
						for(int j=0; j<=10; j=j+1){
							y = y-1;
                                                        Runnable doLater = new Runnable(){
                                                         public void run(){
                                                         comp.repaint(); 
                                                         }
                                                       };
							SwingUtilities.invokeLater( doLater );
							sleep(200);
						}

}
Hopefully something like this will solve your problem. If you use the code, double check the syntax, and it'll probably need other mods specific for your program
807589
I vote for gte42e's recommendation about using a Swing Timer. You could also do this in a background thread as sierratech recommends, but why do this if you're not doing heavy calculations or some other time-hogging computation? Also, if you do go this route, I strongly advise you not to extend Thread and instead either implement Runnable or use a SwingWorker object. Finally, you should look into using key bindings to capture your keyboard input rather than keylisteners.
807589
Thanks to all of you who responded!!!

What is a key binding by the way?
807589
I tried to use a timer like this:
	public void keyPressed(KeyEvent e){
		switch(e.getKeyCode()){
			case KeyEvent.VK_DOWN:
				y += 10;
				break;
			case KeyEvent.VK_UP:
				for(int i=0; i<=10; i=i+1){
				
					timer.start();					
					y = y+1;
						for(int j=0; j<=10; j=j+1){
							y = y-1;
						}
						timer.stop();
						break;
				}
				break;
but it didn't work.
What did I do wrong??
807589
clamm wrote:
but it didn't work.
What did I do wrong??
I don't see anywhere where you are setting the Timer's delay or ActionListener.
To be perfectly honest, it looks like you you're just throwing a timer object in there, calling start and stop, and haven't bothered yet looked at the Swing Timer API or tutorial which is bound to fail. I suggest you look at both. Same for key binding. Good luck!
807589
Sorry I forgot to put my code in about setting the delay and the actionListener.
Here is my new code, but still doesn't work:
	Timer timer;
	
	public myClass(){
		timer = new Timer(1000, new TimerAction());
	}

	public void keyPressed(KeyEvent e){
		switch(e.getKeyCode()){
			case KeyEvent.VK_DOWN:
				y += 10;
				break;
			case KeyEvent.VK_UP:
				timer.start();
				
				System.out.println("Initial:"+y);
				
				for(int i=1; i<=10; i=i+1){
					y=y-1;
					System.out.println(y);
				}
				for(int i=1; i<=10; i=i+1){
					y=y+1;
					System.out.println(y);
				}
				timer.stop();
				break;
                 }
class TimerAction implements ActionListener {
	
	public void actionPerformed(ActionEvent event){
		repaint();
	}
}
Whats wrong??
807589
You're still not using your Timer correctly. Please read the timer tutorial and go through the examples. It's all explained there.
807589
Right now you start a timer that will repaint your window, but then you do all your changes to y and then stop your timer. The timer never gets to run.

You're should be trying to replace your for loops with the timer. Each call to actionPerformed should run one iteration of one of your for loops. You'll need a counter to keep track of which for loop you're in, and when the timer should end. Call timer.stop when the last change to y is complete.
1 - 9
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 18 2010
Added on Apr 20 2010
34 comments
23,473 views