WPF Threading Backgroundworker issue
I have two different background thread who does similar thing but at different time in my WPF application. both are right now independent background worker.
1) first thread runs when you launch application, it downloads all images from connected printer to PC location.
2) second thread does the same thing when use click on some link in my application.
As both worker are independent, even though first thread's downloading process are still running, if user click on link the second thread start their work too
What I would like to do is, when user click on 2nd thread, is there any way I will know about status of first thread ? I mean if i know that first thread is doing it's work then I don't want to even start second thread. I need only second thread when first
one got cancelled by some other reason.
I heard about Mutex but I dont know how it works. Pls share ur idea and some example if you know how to handle this.
Thanks
Dee
Why even have a second instance of BackgroundWorker, why not just reuse the one that you already have? At the very least re-use the variable, so that you remember to dispose of any previous instance. If you are creating a new BackgroundWorker
each time, without disposing of any previous instances, you are definitely going to have memory leaks.
Something along these lines should work for you:
Define a private property to track the BackgroundWorker:
private BackgroundWorker m_Worker;
Define your work and completed events:
private void Work(object sender, DoWorkEventArgs e)
// Do long running work
private void WorkDone(object sender, RunWorkerCompletedEventArgs e)
// Process the results
// Clean up
m_Worker.Dispose();
m_Worker = null;
And then your button click event, which I will leave up to you for the actual implementation for MVVM, if you are using it:
private void ButtonClick(object sender, RoutedEventArgs e)
if (m_Worker != null && m_Worker.IsBusy)
return;
m_Worker = new BackgroundWorker();
m_Worker.DoWork += new DoWorkEventHandler(Work);
m_Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkDone);
m_Worker.RunWorkerAsync();
It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.
Similar Messages
-
I am parsing an XML into a DOM object using the Xerces parser that is packaged with JDK 1.5.
First, I create a new instance of the DocumentBuilderFactory and then using the factory, create a new DocumentBuilder. I then parse the XML using the DocumentBuilder to obtain a DOM object.
Somehow, I am seeing the same DOM object being used for different XMLs.
Is there a thread safety issue with the Xerces parser?certainly, Xerces parser is not thread safe. You have to provide thread safety by making sure that only one thread is allowed to access DocumentBuilder object.
-
Thread Contention Issue , Help !
public class vipThread implements Runnable
private static volatile boolean lockMe=false;
public synchronized static boolean getLock ()
return lockMe;
public synchronized static void setLock (boolean lock)
lockMe = lock;
public void run ()
synchronized(this)
if(!this.getLock ()) {
this.setLock(true);
ret = vipRequestProcessor.getNewRequests ();
this.setLock(false);
getNewRequests is not a synchronized method. Do i need to have it synchronized ? i do have a thread contention issue here. Couple of threds pickup the same request fromt he database.
Help appreciated
thanks
praspublic class vipThread implements Runnable
private static volatile boolean lockMe=false;
public synchronized static boolean getLock ()
return lockMe;
public synchronized static void setLock (boolean
an lock)
lockMe = lock;
public void run ()
synchronized(this)
if(!this.getLock ()) {
this.setLock(true);
ret = vipRequestProcessor.getNewRequests ();
this.setLock(false);
getNewRequests is not a synchronized method. Do i need
to have it synchronized ? i do have a thread
contention issue here. Couple of threds pickup the
same request fromt he database.
Help appreciated
thanks
prasIf the "getNewRequests() method is only called from your vipThread, then you don't have thread contention problem. -
<snip>
This (as you probably know) is due to the fact that the code provided by
most of the DB vendors is not thread safe.
<snip>
Sean's comment, above, speaks to an issue that is causing some concern
within my (large - 180 projects in development) organisation.
May I please ask the forum if there are others out there who have an
understanding of / concern with this "problem"?
My perception (quite possibly flawed) of the "problem" is that the RDBMS
cannot multi-thread data access objects. So we find ourselves in a situation
where we can achieve scaleability in just about all other
performance-sensitive areas of a system's technical architecture (we're
using DCE -- but have found that Encina is not advisable except where there
is a true requirement for heterogeneous distributed 2 phase commit, which we
don't often see.....) but when we go to hit on the RDBMS, we go back to good
ole single-threading.
In certain circumstances, this shortfall of RDBMS technology -- I won't
mention any names, of course, but the initials are "Oracle" -- seems to be
hindering our achievement of a desired technical architecture.
Is this a "Pro*C / PL/SQL stored procedures" problem or is it something that
is in the RDBMSs' DNA?
How can we get around it?
Any comments?
Regards
JonJon
I agree. But it is the best solution within the constraints of existing
technology. At least we don't use a process per client. 10 replicated
copies of a service could service the needs of 100 clients.
Eric
>
At 13:15 6/09/96 EST, you wrote:
Eric
Thanks for your response. Yep. I realise that the issue I've presented is
clearly not something that Forte causes or is responsible for in any way.
Forte can, as you've pointed out, actually help in this area. But I don't
think that getting Forte to spawn another instance of a data access server
is really the best solution. Ie, that's not what we tend to have in mind
when we think about "scaleability". The best solution is -- perhaps -- to
get the RDBMS people to thread-safe all code and libraries. I have pointedly
asked Oracle for a position on this -- and got the usual blank stare.
I also considered whether people might get upset at me for posting what is
clearly a non-Forte-specifc question in a Forte forum. But then I went ahead
and did it anyway. Justification being (assumption follows) that the kind of
people who hang out on the Forte forum may tend to be more
architecture-oriented than your run of the mill VB / SQL*Net / PL/SQL stored
procedures kinda guy/gal, and may be using or considering Forte (plug for
Forte follows) precisely because it clearly enables a superior architecture.
Should proably post to the comp.database.oracle forum, but I just don't know
them as well.
Regards
Jon
From: Eric Gold
To: McLeod, Jon
Cc: [email protected]
Subject: Re: RDBMS non-thread-safe issue
Date: Friday, 6 September 1996 11:21AM
Jon
In response to this message.....read below...
Sean's comment, above, speaks to an issue that is causing some concern
within my (large - 180 projects in development) organisation.
May I please ask the forum if there are others out there who have an
understanding of / concern with this "problem"?
My perception (quite possibly flawed) of the "problem" is that the RDBMS
cannot multi-thread data access objects. So we find ourselves in a situation
where we can achieve scaleability in just about all other
performance-sensitive areas of a system's technical architecture (we're
using DCE -- but have found that Encina is not advisable except where there
is a true requirement for heterogeneous distributed 2 phase commit, which we
don't often see.....) but when we go to hit on the RDBMS, we go back to good
ole single-threading.
In certain circumstances, this shortfall of RDBMS technology -- I won't
mention any names, of course, but the initials are "Oracle" -- seems to be
hindering our achievement of a desired technical architecture.
Is this a "Pro*C / PL/SQL stored procedures" problem or is it something that
is in the RDBMSs' DNA?
How can we get around it?
Any comments?Jon,
Go ahead ask the Forum any questions you want. This "problem"
is not a problem in Forte. What we allow you to do is "replicate" your
data access services so that each one runs inside its own
process. Each one of these processes (aka partitions) has its
own connection to the database. The routing to the replicated
partitions is transparent to the clients. Clients send a
message like "DatabaseService.GetCustomer()" and then the Forte
router sees which replicated copy of the service is not currently
processing a request and routes it to that free replicate. You
can dynamically increase or decrease the number of replicated
copies of the service easily.
We call this feature "load balancing" in Forte. It is achieved
by checking a box in the data access service object definition.
You can dynamically increase/decrease the number of replicates
and also dynamically move replicates to other nodes in the environment.
This approach assumes that you are using application driven
security and not database security. Each replicated copy
of the service is using the same generic username/password
to connect to the database.
I am forwarding this answer to forte-users because others
might not completely understand this feature.
Eric
Eric Gold
Technical Director
Forte Australia
Voice: 61-2-9926-1403
Fax: 61-2-9926-1401
Eric Gold
Technical Director
Forte Australia
Voice: 61-2-9926-1403
Fax: 61-2-9926-1401 -
I'm running CF 9.0.1 on Ubuntu on an "Medium" Amazon EC2 instance. CF has been crashing intermittently (several times per day). At such times, running top gets me this (or something similar):
PID
USER
PR
NI
VIRT
RES
SHR
S
%CPU
%MEM
TIME+COMMAND
15855
wwwrun
20
0
1762m
730m
20m
S
99.3
19.4
13:22.96 coldfusion9
So, it's obviously consuming most of the server resources. The following error has been showing up in my cfserver.log in the leadup to each crash:
java.lang.RuntimeException: Request timed out waiting for an available thread to run. You may want to consider increasing the number of active threads in the thread pool.
If I run /opt/coldfusion9/bin/coldfusion status, I get:
Pg/Sec DB/Sec CP/Sec Reqs Reqs Reqs AvgQ AvgReq AvgDB Bytes Bytes
Now Hi Now Hi Now Hi Q'ed Run'g TO'ed Time Time Time In/Sec Out/Sec
0 0 0 0 -1 -1 150 25 0 0 -1352560 0 0
In the administrator, under Server Settings > Request Tuning, the setting for Maximum number of simultaneous Template requests is 25. So this makes sense so far. I could just increase the thread pool to cover these sort of load spikes. I could make it 200. (Which I did just now as a test.)
However, there's also this file /opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/jrun.xml. And some of the settings in there appear to conflict. For example, it reads:
<service class="jrunx.scheduler.SchedulerService" name="SchedulerService">
<attribute name="bindToJNDI">true</attribute>
<attribute name="activeHandlerThreads">25</attribute>
<attribute name="maxHandlerThreads">1000</attribute>
<attribute name="minHandlerThreads">20</attribute>
<attribute name="threadWaitTimeout">180</attribute>
<attribute name="timeout">600</attribute>
</service>
Which a) has fewer active threads (what does this mean?), and b) has a max threads that exceed the simultaneous request limit set in the admin. So, I'm not sure. Are these independent configs that need to be made to match manually? Or is the jrun.xml file supposed to be written by the CF Admin when changes are made there? Hmm. But maybe this is different because presumably the CF Scheduler should only use a subset of all available threads, right...so we'd always have some threads for real live users. We also have this in there:
<service class="jrun.servlet.http.WebService" name="WebService">
<attribute name="port">8500</attribute>
<attribute name="interface">*</attribute>
<attribute name="deactivated">true</attribute>
<attribute name="activeHandlerThreads">200</attribute>
<attribute name="minHandlerThreads">1</attribute>
<attribute name="maxHandlerThreads">1000</attribute>
<attribute name="mapCheck">0</attribute>
<attribute name="threadWaitTimeout">300</attribute>
<attribute name="backlog">500</attribute>
<attribute name="timeout">300</attribute>
</service>
This appears to have changed when I changed the CF Admin setting...maybe...but it's the activeHandlerThreads that matches my new maximum simulataneous requests setting...rather than the maxHandlerThreads, which again exceeds it. Finally, we have this:
<service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
<attribute name="activeHandlerThreads">200</attribute>
<attribute name="minHandlerThreads">1</attribute>
<attribute name="maxHandlerThreads">1000</attribute>
<attribute name="mapCheck">0</attribute>
<attribute name="threadWaitTimeout">300</attribute>
<attribute name="backlog">500</attribute>
<attribute name="deactivated">false</attribute>
<attribute name="interface">*</attribute>
<attribute name="port">51800</attribute>
<attribute name="timeout">300</attribute>
<attribute name="cacheRealPath">true</attribute>
</service>
So, I'm not certain which (if any) of these I should change and what exactly the relationship is between maximum requests and maximum threads. Also, since several of these list the maxHandlerThreads as 1000, I'm wondering if I should just set the maximum simultaneous requests to 1000. There must be some upper limit that depends on available server resources...but I'm not sure what it is and I don't really want to play around with it since it's a production environment.
I'm not sure if it pertains to this issue at all, but when I run a ps aux | grep coldfusion I get the following:
wwwrun 15853 0.0 0.0 8704 760 pts/1
S
20:22 0:00 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -autorestart -start coldfusion
wwwrun 15855 5.4 18.2 1678552 701932 pts/1
Sl
20:22 1:38 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -start coldfusion
There are always these two and never more than these two processes. So there does not appear to be a one-to-one relationship between processes and threads. I recall from an MX 6.1 install I maintained for many years that additional CF processes were visible in the process list. It seemed to me at the time like I had a process for each thread...so either I was wrong or something is quite different in version 9 since it's reporting 25 running requests and only showing these two processes. If a single process can have multiple threads in the background, then I'm given to wonder why I have two processes instead of one...just curious.
So, anyway, I've been experimenting while composing this post. As noted above I adjusted the maximum simulataneous requests up to 200. I was hoping this would solve my problem, but CF just crashed again (rather it slogged down and requests started timing out...so effectively "crashed"). This time, top looked similar (still consuming more than 99% of the CPU), but CF status looked different:
Pg/Sec DB/Sec CP/Sec Reqs Reqs Reqs AvgQ AvgReq AvgDB Bytes Bytes
Now Hi Now Hi Now Hi Q'ed Run'g TO'ed Time Time Time In/Sec Out/Sec
0 0 0 0 -1 -1 0 150 0 0 0 0 0 0
Obviously, since I'd increased the maximum simultaneous requests, it was allowing more requests to run simultaneously...but it was still maxing out the server resources.
Further experiments (after restarting CF) showed me that the server became unusably slogged after about 30-35 "Reqs Run'g", with all additional requests headed for an inevitible timeout:
Pg/Sec DB/Sec CP/Sec Reqs Reqs Reqs AvgQ AvgReq AvgDB Bytes Bytes
Now Hi Now Hi Now Hi Q'ed Run'g TO'ed Time Time Time In/Sec Out/Sec
0 0 0 0 -1 -1 0 33 0 0 -492 0 0 0
So, it's clear that increasing the maximum simultaneous requests has not helped. I guess what it comes down to is this: What is it having such a hard time with? Where are these spikes coming from? Bursts of traffic? On what pages? What requests are running at any given time? I guess I simply need more information to continue troubleshooting. If there are long-running requests, or other issues, I'm not seeing it in the logs (although I do have that option checked in the admin). I need to know which requests exactly are those responsible for these spikes. Any help would be much appreciated. Thanks.
~DayI really appreciate your help. However, I haven't been able to find the JRun Thread settings you describe above.
Under Request Tuning, I see:
Server Settings > Request Tuning
Request Limits
Maximum number of simultaneous Template requests
Restricts the number of simultaneously processed requests. Use this setting to increase overall system performance for heavy load applications. Requests beyond the specified limit are queued. On Standard Edition, you must restart ColdFusion to enable this setting.
Maximum number of simultaneous Flash Remoting requests
The number of Flash Remoting requests that can be processed concurrently.
Maximum number of simultaneous Web Service requests
The number of Web Service requests that can be processed concurrently.
Maximum number of simultaneous CFC function requests
The number of ColdFusion Component methods that can be processed concurrently via HTTP. This does not affect invocation of CFC methods from within CFML, only methods requested via an HTTP request.
Tag Limit Settings
Maximum number of simultaneous Report threads
The maximum number of ColdFusion reports that can be processed concurrently.
Maximum number of threads available for CFTHREAD
The maximum number of threads created by CFTHREAD that will be run concurrently. Threads created by CFTHREAD in excess of this are queued. On Standard Edition, the maximum limit is 10.
And under Java and JVM, I see:
Server Settings > Java and JVM
Java and JVM settings control the way ColdFusion starts the Java Virtual Machine when it starts. You can control settings like what classpaths are used and how memory is allocated as well as add custom command line arguments. Changing these settings requires restarting ColdFusion. If you enter an incorrect setting, ColdFusion may not restart properly.
Backups of the jvm.config file are created when you hit the submit button. You can use this backup to restore from a critical change.
Java Virtual Machine Path
Specifies the location of the Java Virtual Machine.
Minimum JVM Heap Size (MB) Maximum JVM Heap Size (MB)
The Memory Size settings determine the amount of memory that the JVM can use for programs and data.
ColdFusion Class Path
Specifies any additional class paths for the JVM, with multiple directories separated by commas.
JVM Arguments
-server -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Dcoldfusion.libPath={application.home}/../lib
Specifies any specific JVM initialization options, separated by spaces.
I did go take a look at FusionReactor and found it's not free (which would be fine, of course, if it would actually help). It looks like there's a fully functional demo, which is cool...but I've haven't been able to get it to install yet, so we'll see.
Thanks again!
~Day
(By the way, I've cross-posted this inquiry on StackOverflow. So if you're able to help me arrive at a solution you might want to answer there as well.) -
Thread Dump issue with LD_ASSUME_KERNEL=2.4.1
Hi ,
When I take Thread Dump using 'jstack <PID>' in JDK 1.5 it givss me "sun.jvm.hotspot.debugger.DebuggerException" in the dump nothing more
I set LD_ASSUME_KERNEL=2.4.1 in my server to avaoid some other issue ( JVM crash some times)
Surprisingly, I can not stop my server ( my java process ) after that using our Shutdow scripts , Ctrl C or even "kill -9 <PID>",
I have to restart the machine or manually release uncleaned resources that my server occupied and restart the server
This happens Redhar 9 as well as in Linux ES.
Anybody faced similar problem?
Any help or information regarding this is highly apprecialted
Vasu
Thread Dump Output:
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Meth
od)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(Li
nuxDebuggerLocal.java:431)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(Linux
DebuggerLocal.java:109)
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_re
gs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(L
inuxDebuggerLocal.java:134)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebugge
rLocal.java:437)
at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:48)
at sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.getCurrentFrameGuess(LinuxX86
JavaThreadPDAccess.java:75)
at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:42)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Meth
od)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(Li
nuxDebuggerLocal.java:431)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(Linux
DebuggerLocal.java:109)
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_re
gs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(L
inuxDebuggerLocal.java:134)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebugge
rLocal.java:437)@brain0
I've downloaded the glic-2.3.6 sources from gnu, so I could build it from those. I'm however reluctant to do this because I really don't want to break my install.
I do agree with you on the NPTL statement, but pvs relies on allegro, which relies on LinuxThreads. Allegro is not being ported to new versions of glibc, so that approach is unfortunately not viable.
@iphitus
I wasn't very specific - it's allegro as in a lisp environment.
I think I'll try and install an old version of arch on wmware instead. Is there anywhere you can check out glibc version numbering on old arch install isos (ie. do I need arch-0.[1-9].iso)? And anywhere you can download the old isos (tried filewatcher, but a lot of the older sites seem broken)?
Thanks for the replies,
Mads
PS. I noticed that you recommended slackware for old kernels in another thread. I'm however in a bit different situation as I need old versions of glibc. Furthermore I would prefer sticking to arch, but was wondering whether there were any specific reasons for not doing that. -
Oracle Application Server 10g thread stuck issue.
We are having,
Oracle Application Server 10g [10.1.3.1 + 10.1.3.4patch] along with Oracle Http Server 2.0
Now there is a issue of thread stuck [some application threads taking longer times] due to which the application server is unable to respond and sometimes it reinits the oc4j instance.
=> Is there any setting to increase the Thread Stuck Time in OAS.
=> Is there any setting to stop the auto reinit of oc4j instance.
=> Does the auto re init of oc4j get logged in opmn.log as well as in service.log.
It will be really helpful if any advice on the same.
Thanks in advance...
ManojCLook in httpd.conf file anything that is like thread in there you will find a simple description of the Directives.
Greetings. -
THREAD SAFETY ISSUE OF SERVLET
It is possible that one instance of a sevlet is accessed by multiple
client , then how is the concurrency issue taken care of? Especually thread safety?It's not, you have to handle it yourself.
That's why it's a good idea to never put instance variables in servlets. The basic technique is to store anything you need to save between requests in the current user's session (which you get by calling request.getSession()). During a call to service() (or, more frequently, to doGet or doPost, you're safe if you use whatever is present in the request and response argument, including servlet config parameters, request parameters, request attributes, and session attributes.
If you want to write some "real" servlet app, you should have a look at one of the frameworks, like Jakarta Struts or OpenSymphony WebWorks. -
Does SimpleDateFormat still have Thread Safety Issue in jdk 1.4.2_8?
Hi,
We are using jdk1.4.2_08 and experience following error message intermittently, sometimes once in 5000 or 10000 or 2/3 times in 20000 message processing.
On one occassion, it reported as Empty String and other time it reported as ".20042005E200420054E". I won't suspect the input that's coming to this class since it works with same message over and over.
2005-07-18 19:13:54,733 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): java.lang.NumberFormatException: empty String
2005-07-18 19:13:54,740 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:983)
2005-07-18 19:13:54,745 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.lang.Double.parseDouble(Double.java:220)
2005-07-18 19:13:54,751 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.text.DigitList.getDouble(DigitList.java:127)
2005-07-18 19:13:54,756 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.text.DecimalFormat.parse(DecimalFormat.java:1070)
2005-07-18 19:13:54,761 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1705)
2005-07-18 19:13:54,767 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1156)
2005-07-18 19:13:54,772 [RMI TCP Connection(6960)-10.120.102.97] INFO org.jboss.logging.util.LoggerStream write(140): at java.text.DateFormat.parse(DateFormat.java:333)
It seems like some people have reported BugID 4228335 and there are few associated bugs. I assumed these are fixed in jdk1.4.
Can anyone please suggest if this kind of issues still exist in jdk1.4.2?
Here is the piece of code.
private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public Object convert(Class type, Object inValue) {
if(inValue == null)
return null;
NFDate ret = (NFDate) ClassDirectoryFactory.GetInstance().getClassInstance(NFDate.CLASS_KEY);
if (inValue instanceof Date) {
ret.setDate((Date)inValue);
} else if (inValue instanceof String) {
String str = inValue.toString();
if (str != null && str.length() > 0) {
DateFormat format = DateFormat.getDateTimeInstance();
format.setLenient(true);
try {
ret.setDate(format.parse(str));
} catch (ParseException e) {
try {
ret.setDate(DATE_FORMAT.parse(str));
} catch (ParseException e1) {
throw new DateConversionException("Unable to convert the String to NFDate. " +
"Exception: " + e + " - expected format is (" + format.format(new Date()) + ")", e1);
else {
if (!ret.getIsNullDate()) ret.reset();
} else {
String msg = "Conversion from " + inValue.getClass().getName() + " to " + NFDate.class.getName() +
" is not supported";
throw new DateConversionException(msg);
return ret;
Thanks much in advance.
SaikatIt doesn't look like the format classes will ever be made thread safe. The fact that they aren't isn't a bug, it is a design choice that Sun made. If you need them to be thread safe, then you will have to do the synchronization yourself.
If you have a finite number of threads for you application (like a thread pool) then you might consider using ThreadLocal so that separate threads will not be trying to access the same formatter. -
Ios 4 threaded email issue with outlook inbox?
Anyone else have mail in their outlook inbox get removed or otherwise hidden when threading is turned on in IOS 4?
I can see the full threaded conversation on the phone, but only the most recent message in a thread is in my outlook inbox.
Input, solutions?Hi. This is a very delayed post to your original. I would like though to ask if you still have fully threaded emails in your iPhone. Since iOS 4.1 there are apparent issues, and it depends how you define 'threaded'. I am using Gmail and they have a threaded/conversations method of reading mail, very useful to see the entirety of a discussion. On my new iPhone 4 using the iPhone native mail app will not show threaded, only all of the messages from the other party, I'd need to scroll through a message to see my own input.. Or look in the Sent Mail folder. Both of which seem antiquated to me. I was interested in your post as you describe seeing your threaded mail properly on iPhone. Is this still the case?
Thanks
AMH. -
Hi, here's the issue. I created an incredibly long table that spans multiple pages. When I click the thread/link button (red plus sqaure at the bottom right of the text box) and link it to the next text box, the top entries are listed not the bottom ones that have been cut off. I'm not sure what's happening and I'm not sure what to search to find an answer.
Thanks in advance,
MitchThank you so much, that was EXACTLY what was wrong. I've got one more question, it's not a big hassle if it can't be done. I have headers that separate the different products into the different categories and know that I can get them to repeat on the next page. The category headers are in the same table as the products themselves. The problem is I've also created a separate table for the column names as it's own header. Unfortunately, the columns aren't lining up, so It looks like this.
| Product Name | SKU | Specs | Price |
| Category 1 |
| Product 1 | 201102 | 23" x 13" x 5" | $3.00 |
So the "body" table is with the category headers are set up the way they need to. Is there any way to get the column names' table to line-up automatically or more simply, have the copyied tables linked together so if I change the one, the rest do as well? -
Online Threads Atachment Issues
Regards from Sweden,
When I access "Online Threads", if I wish to attach a photo, I am unable to do so as only "My Location" is available. The other choices such as "Picture", "Video", "Voice Note" and "Contact" remain grey and are thus unusable. Is this a common problem and what would be the solution? Another minor problem is the length of online messages. If the message is more of shall we say, "letter size", instead of just a few lines, often the message will not send and I have to break it up into segments and resend. Is there a limit to the length of an online message? Apart from these issues, my Nokia 920 is exellent though my wife's Samsung Ativ8 has far better battery life!
Attachments:
wp_ss_20131014_0001.png 51 KBthis is a limitation of the OS.
if you used to use Symbian/maemo/meego devices, then you were able to do this, but not able to on windowsphone. -
Hi,
Is BackgroundWorker a recommended way to write a multi-threading application? If not, what is the preferred way for multi-threading programming?
Thanks in advance!Thanks for the comments.
Below is the scenario:
A main application is monitoring any incoming files in a network folder.
Whenever a new file turns up, application will start a BackgroundWorker to process the file.
There may be many files constantly go to this folder
Q: do I need to create a BackgroundWorker for each individual file?
Thanks for your help. -
Official XXL5200U Thread of Issues/Comments
Just picked up a 50L5200U, but it seems that Toshiba has a some other sizes of this same model so this thread is for any size of that model. Really liking the TV so far but have found two small issues.
1. Is there anyway to tell if the signal being sent to the TV is at 60hz vs 24hz (24p mode that some Blu-Rays offer to make the movie look more like film in a theater)? My old TV always showed "1080p 60hz" or "1080p 24hz" when I pushed the info button, but I can't find a way to tell on this tv.
2. Seems that the "Game Mode" option doesn't stay after you switch to another input or turn the TV off. Very annoying because I find I need to go back into anytime I want to play PS3 or Wii.
Maybe these two items can be addressed in a future Firmware update?
What other issues do people have?
Feel free to share your video settings as well.So after owning the TV for over a month -- I have determined that the PS3 will automatically send a 24p signal on Blu-Ray discs if it is able to do so.
Also - I programmed my Google TV box so that switching to Game Mode isn't a chore anymore...
But I still wouldn't mind the next Firmware Update addressing the fact that Game Mode always resets off.
- I have found the picture settings for "Movie" to be the best all around. -
I have been trying to use threads in coding, but even a simple thread program from the java.sun.com seems to generate an error. I get an error like
java.lang.NoClassDefFoundError: SlideShow/SlideShow (wrong name: SlideShow)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:561)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
at sun.applet.AppletPanel.run(AppletPanel.java:298)
at java.lang.Thread.run(Thread.java:534)
for any thread program I put in my IDE
I feel if I could solve this security issue, I could get around to use threads in the program I am working on.
I am using NetBeans v 4.0 IDE .
Thanks a lot in advance,
Sathyit's a class not found error, not a security error. If in a jar, make sure your class files are in the correct folders to match the package order. If not in a jar, make sure your classpath points at the location of the class files
Maybe you are looking for
-
Referencing static html pages from jsps...
Hi, This is probably a very simple thing to solve, but I'm having problems with referencing html pages from jsps under Weblogic. I get Error 404 - not found, whenever I try something like this in a JSP...
-
Firefox will not open a web page
I installed firefox but can not get the program to launch a web page. What do I do to resolve this?
-
I am working on Oracle Portal reports, I need some dynamic LOVs for the Query Screen. Could you tell me which version of Oracle Protal provides Dynamic LOV functionality? My version is 3.7. If 3.7 does not provide this functionality, is there any way
-
I need to re-create the database to solve the system tablespace fragmentation. Could some body tell me how to do it? Should I first recreate the system tablespace first? and then create the tablespace one by one? Could somebody help me out? Thanks
-
BRAND NEW iBook's display won't close
I had just bought my iBook G4 12" and after a few hours, it seemed my latch was broken. That really bothers me.