CSS11506 - problem

Hi all,
I have to check  CSS11506 configuration to answer the question from client who complaints that the access to Loadbalancing too slowly
Below is Css configuration file
Pls help me if there is any misconfiguration
!*************************** GLOBAL ***************************
  load teardown-timer 120 
  load ageout-timer 180 
  no restrict web-mgmt 
  app 
  load step 100 dynamic 
  ip route 0.0.0.0 0.0.0.0 10.10.10.1 1 
!************************* INTERFACE *************************
interface  1/1
  description "connecting_to_outside" 
interface  1/2
  bridge vlan 2 
  description "connecting_to_server" 
!************************** CIRCUIT **************************
circuit VLAN1
  ip address 10.10.10.21 255.255.255.224 
circuit VLAN2
  ip address 10.10.10.1 255.255.255.0 
!************************* KEEPALIVE *************************
keepalive A_keepalive_App1 
  ip address 192.168.1.162 
  method get 
  type http 
  uri "/abc/index.htm" 
  maxfailure 1 
  frequency 20 
  active 
keepalive A_keepalive_App2 
  ip address 192.168.1.164 
  type http 
  method get 
  uri "/abc/index.htm" 
  maxfailure 1 
  frequency 20 
  active 
keepalive A_keepalive_App3 
  ip address 192.168.1.165 
  type http 
  method get 
  uri "/abc/index.htm" 
  maxfailure 1 
  frequency 20 
  active 
keepalive A_keepalive_App4 
  ip address 192.168.1.166 
  type http 
  method get 
  uri "/abc/index.htm" 
  maxfailure 1 
  frequency 20 
  active 
!************************** SERVICE **************************
service Appsrv_1 
  weight 8 
  max connections 800 
  ip address 192.168.1.162 
  keepalive type named A_keepalive_App1 
  active 
service Appsrv_2 
  weight 8 
  max connections 700 
  ip address 192.168.1.164 
  keepalive type named A_keepalive_App2 
  active 
service Appsrv_3 
  weight 8 
  max connections 800 
  ip address 192.168.1.165 
  keepalive type named A_keepalive_App3 
  active 
service Appsrv_4 
  weight 8 
  max connections 800 
  ip address 192.168.1.166 
  keepalive type named A_keepalive_App4 
  active 
!**************************** EQL ****************************
eql A_images_rule 
  extension jpeg 
  extension gif 
  extension css 
  extension js 
  extension png 
!*************************** OWNER ***************************
  content abc_rules 
    add service Appsrv_1 
    add service Appsrv_2 
    add service Appsrv_3 
    add service Appsrv_4 
    protocol tcp 
    port 80 
    url "" 
    vip address 10.10.1.0.12 
    advanced-balance sticky-srcip 
    balance srcip 
    active 
!*************************** GROUP ***************************
group abc_Group 
  add destination service Appsrv_1 
  add destination service Appsrv_2 
  add destination service Appsrv_3 
  add destination service Appsrv_4 
  vip address 192.168.1.168 

Hi there.
Certs and keys are stored under c:/CertStore/ssl/
To access you must go in debug mode:
"llama" to enter debug mode
Once you are in llama mode, you can try to delete the file with command:
ap_file delete c:/CertStore/ssl/aaaRSAkey.pem
Hope this helps.
/dom

Similar Messages

  • Keepalive problem on CSS11506

    Greeting
    One of application which using my CSS has problem to work with my CSS11506 after the application upgrade.
    It does not regconize CSS' keepalive check and give error "broken pipe" on the backend server. (it treat the keepalive traffic as session?)
    The CSS configuration for the application is:
    service dev-host1-2304
    ip address 10.2.2.21
    protocol tcp
    port 2304
    keepalive type tcp
    keepalive port 2304
    active
    service dev-host2-2304
    ip address 10.2.2.22
    protocol tcp
    port 2304
    keepalive type tcp
    keepalive port 2304
    active
    content dev-2304
    vip address 10.1.1.123
    port 2304
    protocol tcp
    balance leastconn
    add service dev-host1-2304
    add service dev-host2-2304
    active
    the backend server error messages is:
    <log4j:event logger="com.webct.platform.tools.chatwb.server.ChatWBServer" timestamp="1201219035043" level
    ="ERROR" thread="Thread-0">
    <log4j:message><![CDATA[CLASS: com.webct.platform.tools.chatwb.server.ChatWBServer METHOD: run
    Caught exception - attempting to continue]]></log4j:message>
    <log4j:throwable><![CDATA[org.beepcore.beep.core.BEEPException: java.net.SocketException: Broken pipe
    at org.beepcore.beep.transport.tcp.TCPSessionCreator.listen(TCPSessionCreator.java:214)
    at com.webct.platform.tools.chatwb.server.ChatWBServer.run(ChatWBServer.java:770)
    ]]></log4j:throwable>
    </log4j:event>
    <log4j:event logger="com.webct.platform.tools.chatwb.server.ChatWBServer" timestamp="1201219096053" level="ERROR" thread="Thread-0">
    <log4j:message><![CDATA[CLASS: com.webct.platform.tools.chatwb.server.ChatWBServer METHOD: run
    Caught exception - attempting to continue]]></log4j:message>
    <log4j:throwable><![CDATA[org.beepcore.beep.core.BEEPException: java.net.SocketException: Broken pipe
    at org.beepcore.beep.transport.tcp.TCPSessionCreator.listen(TCPSessionCreator.java:214)
    at com.webct.platform.tools.chatwb.server.ChatWBServer.run(ChatWBServer.java:770)
    ]]></log4j:throwable>
    </log4j:event>
    <log4j:event logger="com.webct.platform.tools.chatwb.server.ChatWBServer" timestamp="1201219157048" level="ERROR" thread="Thread-0">
    <log4j:message><![CDATA[CLASS: com.webct.platform.tools.chatwb.server.ChatWBServer METHOD: run
    Caught exception - attempting to continue]]></log4j:message>
    <log4j:throwable><![CDATA[org.beepcore.beep.core.BEEPException: java.net.SocketException: Broken pipe
    at org.beepcore.beep.transport.tcp.TCPSessionCreator.listen(TCPSessionCreator.java:214)
    at com.webct.platform.tools.chatwb.server.ChatWBServer.run(ChatWBServer.java:770)
    ]]></log4j:throwable>
    </log4j:event>
    Question:
    1. Is it CSS's problem?
    2. How can I configure keepalive for port 2304 to fix the error message? or how the application should configure to match with CSS11506?
    Any comments will be appreciated
    Thanks in advance

    I have found what the application do is:
    When you connect to port 2304 on the application server, if functional, the SocketServer service sends a banner:
    RPY 0 0 . 0 246
    Content-Type: application/beep+xml
    http://xxxxx/xxxx/Profile' />http://xxx/xxx/TLS
    ' />http://xxxxxxx/xxxxProfile' />END
    So, I need to script for receiving "END".
    I have looked the script for socket:
    kwd-css:julie(config)# socket ?
    connect connect to a remote host
    disconnect Disconnect a currently connected socket
    inspect Inspect data received on a socket
    receive Receive data through a socket
    send Send a string of data to a remote host
    waitfor Wait for a specific data string to be received through the
    socket
    css11506# socket receive ?
    Socket number to send data through
    Css11506# socket receive 1 ?
    Execute command
    Number of milliseconds to receive data (default 100ms)
    raw Receive data in hexidecimal format (no ascii conversion)
    css11506# socket receive 1 2000 ?
    Execute command
    raw Receive data in hexidecimal format (no ascii conversion)
    css11506# socket receive 1 2000 raw ?
    Execute command
    it looks like there is no way to check if received is "END" or not?
    Could you please advice?
    1. To receive a banner, should I use keepalive tcp?
    2. Do I need special the "socket receive" command
    3. Does "socket receive" has a buffer or variable to store the banner, so I can check if the "END" is there?
    Any comments will be appreciated
    Thanks in advance

  • CSS and Extended Passive FTP problem.

    Hi everyone.
    I'm having a problem setting up a load balanced cluster of FTP servers behind a CSS 11506.
    I can FTP into the cluster fine. I am redirected to one of the machines in a round robin fashion and can log in. The problem arises on mac's where typing in an ls command returns this:
    ftp> ls
    229 Entering Extended Passive Mode (|||32999|)
    200 EPRT command successful
    421 Service not available, remote server timed out. Connection closed
    Now, if I type in the EPSV command and disable Extended Passive Mode prior to connecting to it, it works fine.
    Also, connecting to any of the servers directly with epsv enabled works fine as well.
    We have over 800k hits per month and telling everyone to disable epsv will be a problem. Is there a way to enable extended passive mode through the css?
    Here is my config:
    Group: ftpServers1 - Active (198.202.122.181 Not Redundant)
    Session Redundancy: Disabled
    Last Clearing of Stats Counters: 03/20/2007 14:28:25
    Associated ACLs: NONE
    Source Services:
    DNS
    Name: Hits: State: Load: Trans: Keepalive: Conn:
    rem_ftp1 19857 Alive 44 6 FTP 0
    rem_ftp2 38175 Alive 87 0 FTP 0
    Destination Services:
    NONE
    Group Service Total Counters:
    Hits/Frames/Bytes: 58032/58339/4277264
    Connections Total/Current: 25/0
    FTP Control Total/Current: 0/0
    CSS11506# show rule pdb ftp-rule1
    Name: ftp-rule1 Owner: pdb
    State: Active Type: FTP
    Balance: Round Robin Failover: N/A
    Persistence: Enabled Param-Bypass: Disabled
    Session Redundancy: Disabled
    IP Redundancy: Not Redundant
    L3: 198.202.122.181
    L4: TCP/21
    Url:
    Redirect: ""
    TCP RST client if service unreachable: Disabled
    Rule Services & Weights:
    1: rem_ftp1-Alive, S-1
    2: rem_ftp2-Alive, S-1
    Thanks
    Boki

    EPSV is not supported.
    The only workaround available to load balance passive ftp servers is to use "PASV" command instead of "EPSV" on clients.
    Syed Iftekhar Ahmed

  • CSS11506 http header rewrite question

    Hi
    I read the ACE doc, and it said that cisco ACE supports the capability to rewrite http headers in both client requests and server responses. Is CSS11506 can do it?
    I have a lot of problems that application on the local server redirect https to http. Because the way they do installation which standard way and it can not fix or hardly to fix.
    I would like to get a tip to let css11506 rewrite the server's rewrite. is it possible?
    Any comments will be appropriated
    Thanks in advice
    julxu

    Hello Julxu,
    If I understand your question correctly, you are looking for the CSS rewrite the URL from http to https when the server sends a redirect to the client.  If I'm correct, then you can find out how to accomplish this in the Specifying Secure URL Rewrite sectioin of the CSS configuration guides.
    Hope this helps,
    Sean

  • Page lookups slower when use css11506?!

    I have configured one armed test load balancing for L4 (http) as below:
    service web-test1
    ip address 10.10.10.253
    keepalive type tcp
    keepalive port 8100
    active
    service test2
    ip address 10.10.10.254
    keepalive type tcp
    keepalive port 8100
    active
    owner WEB-Farm
    content http-test
    vip address 10.10.1.56
    add service web-test1
    add service web-test2
    balance aca
    port 8100
    protocol tcp
    active
    group http-test-group
    vip address 10.10.1.56
    add destination service web-test1
    add destination service web-test2
    active
    Our test result shows it slow than just software load balancing on http server.
    Please confirm if my configuration is right?
    If so, is one arm configuration will slow the lookup speed?
    if not, what is the problem can be? and how to deb the problem?
    Any comment will be appreciated
    Thanks in advance

    Great thanks for the reply.
    it is a new setupped test environment.
    The test staff said:
    I did notice some strange behaviour that may/may not be related to this problem. The test going through the CISCO switch took a very long time to 'ramp-up' it processing - i.e. it was about 25-30 minutes of basically very slow processing and then later on it sped up.
    Is possible I need change some option?
    Is possible there is spanning tree problem?
    It is not routing problem because the box is configured static routing ( all to next hop - cisco route)
    It hardly to belive it is web server problem, because the test use same servers for both tests, that is load balance thought css11506 and thought a software resident inside one of web server.
    Why it is slow at first half hour and than it sped up?

  • Commit_VipRedundConfig problem.

    I have problem to sync configuration from master to backup.
    CSS11506# commit_VipRedundConfig "-d"
    CSS11506#
    Checking available disk space on systems ...
    Checking the disk space locally before continuing with the script.
    Verifying that another local session is not running the script.
    Creating script/vipr_config_sync_lock file.
    Verifying app and redundancy configs ...
    Verifying that app session is up with backup switch.
    Making sure app session is up.
    Seconds to wait before calling it quits: 60
    Checking the disk space remotely before continuing with the script.
    Checking local and remote switch versions ...
    Storing the running code versions of the local and remote switch.
    Storing the local switch's version.
    Retrieving the remote switch's version.
    Checking remote version for 4.0
    Checking if switch is BACKUP for any virtual routers and if
    the state is 'No Service'.
    Checking vip redundancy state ...
    Working ...
    Checking if backup switch is Master for any VRIDs.
    If it is, either a local interface that once held redundant vips
    has been removed or the Backup is a Master for another vip-redundant
    relationship.
    Checking remote redundant vips ...
    Saving Master running-config to startup-config and archiving startup-config.
    Copying running-config to startup-config.
    Archiving startup-config.
    Swapping Master and Backup ip addresses in tmp.cfg for app
    and redundancy interface.
    Error in script playback line:1500
    >>>function REPLACE_TEXT call "tmp.cfg localIp backupIp 0 SUB_STRING_IP"
    CSS11506#
    Script Playback cancelled.
    could anyone advice me what problem I got?
    Any comments will be appreciated
    Thanks in advance

    Hi Syed
    Great thanks for reply, I must miss it out.
    # sh app session verbose
    App Session Information 'no hostname':
    Session ID: 8a3bf9c0 IP Address: 10.1.1.92 State: APP_SESSION_UP
    Local Address: 10.1.1.91 rcmdEnable: Enabled
    KalFreq: 14 Auth Type: none Encrypt Type: none MaxFrameSz: 10240
    Pkts Tx: 543679 Pkts Rx: 543694 Pkts Rej: 0
    Last UP event:AUG 2 22:21:34
    FSM Events:
    STOP: 0
    INIT: 1
    OPEN: 1
    AUTH: 1
    UP : 1
    DOWN: 0
    Attached Apl: 0xa03055c
    Attached Apl: 0x20206e00
    The APP session IP is the management IP. So, looks it is wrong to use management IP. do I have to use a interface specially for APP?
    Please advice.

  • CSS11506 offloading SSL, Websphere and IE 6 SP2

    Environment - CSS11506 offloading SSL and balancing between 2 IBM websphere(webseal) servers
    Issue - When using IE6 SP2 (only)and attempting to upload small file (53 Bytes) - returns 'Page Not Displayed' - if wait time before submitting file exceeds 10-15 seconds, upload completes normally. If "show friendly HTTP error messages' is UNCHECKED in IE options, problem DOES NOT exist. Thoughts?

    This is a known IE bug we recently ran into. See http://support.microsoft.com/?id=921090 for more information and a way to contact Microsoft to get a patch for this.

  • Sticky configuration at CSS11506

    When I configure sticky option on contents as follow
    content www
    vip address 172.16.1.1
    add service web1 weight 2
    add service web2 weight 3
    add service web3 weight 4
    balance weightedrr
    advanced-balance sticky-srcip
    sticky-mask 255.255.255.0
    protocol tcp
    port 80
    active
    There was no problem for common clients.
    If no sticky options applied for any clients.
    What will the problem be.
    Or Any case like that was?
    My OS Version and device are 7.1Build109s and CSS11506.
    In above content configuration, when I add line application SSL
    then what will be happened.
    what is the difference between Using 'application SSL' and not using 'application SSL'

    the only possible problem is the limit of size for the sticky table.
    32k with 128MB
    128k with 256MB
    Once the table is full we delete old entries (FIFO) or if you have sticky timer, we do not delete old entries and reject creation of new entry.
    Gilles.

  • Microsoft sharepoint 2007 behind cisco CSS11506

    Greating
    I have problem to let sharepoint 2007 work with css11506.
    The sharepoint configure to use load balancing, configure something they called reverse proxy. and they insiste the configuration is working other environmento such as ISC.
    However, we used as below configuration, and it insists to change https to http when user login.
    I have searched internet for this issue, and find cisco some solution for ACE but no css11500.
    Could anyone advice me if css11506 can handle this problem? if so, how to?
    the configuration is below:
    content ssl-sharepoint7-rule
    vip address 10.1.1.14
    protocol tcp
    port 443
    add service ssl-slot3-srv
    active
    content ssl-sharepoint7-rule2
    vip address 10.1.2.14
    balance leastconn
    advanced-balance arrowpoint-cookie
    add service sharepoint-test1-80
    add service sharepoint-test2-80
    protocol tcp
    port 81
    url "/*"
    active
    service sharepoint-test2-80
    ip address 10.1.3.52
    protocol tcp
    port 80
    keepalive type tcp
    keepalive port 80
    active
    service sharepoint-test1-80
    ip address 10.1.3.51
    protocol tcp
    port 80
    keepalive type tcp
    keepalive port 80
    active
    the http working fine. just https not work.
    Any comment will be appreciated
    Thanks in advance

    thanks for reply, the service configuration is:
    service ssl-slot3-srv
    type ssl-accel
    keepalive type none
    slot 3
    add ssl-proxy-list ssl-slot3
    active

  • CSS11506 - show flows

    Hello all,
    I have a CSS11506 with the following config...
    !************************** SERVICE **************************
    service pas_main_uswrnsa0ptf01_11111
    ip address 172.16.25.30
    keepalive type tcp
    keepalive port 11111
    port 11111
    active
    service pas_main_uswrnsa0ptf02_11111
    ip address 172.16.25.31
    keepalive type tcp
    keepalive port 11111
    port 11111
    active
    service pas_main_uswrnsa0ptf03_11111
    ip address 172.16.25.32
    keepalive type tcp
    keepalive port 11111
    port 11111
    active
    service pas_main_uswrnsa0ptf04_11111
    ip address 172.16.25.33
    keepalive type tcp
    keepalive port 11111
    port 11111
    active
    !*************************** OWNER ***************************
    owner PAS
    content PAS-pas_main-2008-11111
    vip address 123.123.130.222
    protocol tcp
    port 11111
    url "/*"
    balance aca
    application ssl
    add service pas_main_uswrnsa0ptf01_11111
    add service pas_main_uswrnsa0ptf02_11111
    add service pas_main_uswrnsa0ptf03_11111
    add service pas_main_uswrnsa0ptf04_11111
    active
    !*************************** GROUP ***************************
    group PAS-pas_Dgraphs
    vip address 172.16.25.11
    add destination service pas_main_uswrnsa0ptf01_11111
    add destination service pas_main_uswrnsa0ptf02_11111
    add destination service pas_main_uswrnsa0ptf03_11111
    add destination service pas_main_uswrnsa0ptf04_11111
    active
    I can access my servers just fine, but when issuing the 'show flows' command, I do not see my traffic... even though I can see my hit counters incrementing.
    NOTE: The 'application ssl' command is something new for us, so I thought it may be related to this.
    Any ideas?
    Thanks,
    -Adam

    Gilles,
    The target IP is the content VIP 123.123.130.222 (as shown in my CSS config). However, I am testing from one of the four servers (services) associated with this content rule. Could that be causing the problem with the CSS not seeing these flows?
    For example...
    I am sitting on server uswrnsa0ptf01 and I test to the content VIP 123.123.130.222... and it works... but I see know flows in the CSS.
    I've attached a drawing showing our network topology.
    Thanks,
    -Adam

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

Maybe you are looking for

  • Configure standby database

    hi all; how many system r required to configure standby database i m configure standby database in a single(same) system where my primary database already running.if this possible or not i have configured my standby but when i start "c:\sqlplus sys@o

  • After I ran factory recovery manager I ran into Command screen .. Now what?-

    after I ran factory recovery manager for my HP Compaq Presario CQ60 220us everything was moving right along and I must have blinked because now I'm looking at this black command prompt screen  with a cursor flashing waiting for me type write a comman

  • Downloading Photoshop Lightroom 4

    Hello, I purchased Adobe Photoshop Lightroom 4 early last week, or perhaps even the week before -- I can't remember. The transaction has gone through and I have been charged for the program, which is why I'm particularly concerned. I purchased the st

  • Real problem with highlights

    Sorry for posting a new one but I am in real trouble here On a simple menu with 3 buttons that i built in photoshop CS2 I have a nice simulation with the correct highlights appearing on my buttons when I roll over then if i build the DVD the buttons

  • Phone won't boot

    My xperia ray won't boot, the logo doesn't even appear,it's just black. The phone has an unlocked bootloader. I was flashing a custorm using CWM when this happened, and I can't get into recovery. Tried flashtool to flash new rom. and the rom is insta