Results 1 to 2 of 2
  1. #1
    gabel8 is offline Member
    Join Date
    Jan 2014
    Posts
    5
    Rep Power
    0

    Default Joda time threading

    I have an application that uses multiple threads to access logic. I am using joda time to compare dates because joda time is thread safe. Below is the example method I am using. My question is being that joda time is thread safe, does it matter whether or not I am using a static method rather than an instance method? Should I use one or the other? Any help would be great.

    Java Code:
    public static boolean isDateEqual(Date checkedDate, String targetDateString) {
            boolean passed = false;
            if (checkedDate != null && targetDateString != null && !targetDateString.equals("")) {
                DateTime checkedDateTime = new DateTime(checkedDate);
                DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy");
                DateTime targetDateTime = fmt.parseDateTime(targetDateString);
                if (DateTimeComparator.getDateOnlyInstance().compare(checkedDateTime, targetDateTime) == 0) {
                    passed = true;
                }
            }
            return passed;
        }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Joda time threading

    It doesn't matter.
    What matters is whether your code is using any shared variables from outside of the method, and it isn't, at least nothing that's not part of Joda.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Joda-Time file path problem
    By SamJava_the_Hut in forum New To Java
    Replies: 7
    Last Post: 03-27-2014, 01:42 AM
  2. Getting started with joda.time
    By SamJava_the_Hut in forum New To Java
    Replies: 0
    Last Post: 10-15-2013, 05:18 AM
  3. Replies: 3
    Last Post: 08-23-2011, 01:46 PM
  4. Replies: 0
    Last Post: 12-21-2010, 07:09 AM
  5. threading execution time question
    By centenial in forum Threads and Synchronization
    Replies: 4
    Last Post: 09-09-2010, 06:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •