You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Yonik Seeley (JIRA)" <ji...@apache.org> on 2008/11/12 21:25:44 UTC

[jira] Created: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Can't create NIOFSDirectory w/o setting a system property
---------------------------------------------------------

                 Key: LUCENE-1451
                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
             Project: Lucene - Java
          Issue Type: Bug
            Reporter: Yonik Seeley
            Priority: Minor


NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647644#action_12647644 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

When I was reviewing getDirectory() I can across a race condition anyway - could lead to handing out a closed directory.  But people would need to be opening and closing directories rapidly from multiple threads, so I'm not sure if it's actually bitten anyone.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650344#action_12650344 ] 

Doug Cutting commented on LUCENE-1451:
--------------------------------------

A bit of history, if any care.

Originally Lucene synchronized only on the Directory to coordinate index writes.  This was the primary motivation for the Directory cache.

http://tinyurl.com/62ugs9#l120

Later, lock files were added, but Directory synchronization remained as an optimization, to avoid hitting the filesystem when coordinating threads in the same process.

http://tinyurl.com/5dzsyq#l125

Now Directory-based synchronization has been dropped entirely, so the Directory cache can now go too.




> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated LUCENE-1451:
---------------------------------

    Attachment: LUCENE-1451.patch

Attaching untested patch implementing logic above.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647103#action_12647103 ] 

Mark Miller commented on LUCENE-1451:
-------------------------------------

bq. Hmm good point. Actually why do we do this 'single instance of FSDir per File' again? Is it really needed?

While it might be useful sometimes, I don't see how it really is needed. I think a better solution is allowing for direct instantiation while providing a factory class if for some reason you need that behavior. Most apps I have worked with do not need it and I don't understand why its forced on you, other than a bit of overprotection.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647077#action_12647077 ] 

Hoss Man commented on LUCENE-1451:
----------------------------------

bq. It seems like we should make it possible to create multiple FSDirectory implementations of different types in the same JVM.

As mentioned in the thread that spawned this issue...

1. i'm not sure i see any real motivation for this.  the biggest motivation to use an alternate impl will be OS (which is fixed for the whole JVM)
1. if i'm reading it right, this patch won't work if two different callers ask for Directories backed by the same File using different directoryImpl instances ... the first one will go into the DIRECTORIES cache and "win" for all future calls.


that second problem can be solved in a similar way to the lockFactory check ... but like i said: this seems like a can of worms, with very little real advantage over a simple static setter.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley resolved LUCENE-1451.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.9

Committed.  Thanks for the input guys!

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated LUCENE-1451:
---------------------------------

    Attachment: LUCENE-1451.patch

Ok, here's a version that adds public constructors, and a test that ensures that reading, writing, and locking all work concurrently in the same directory with different FSDirectory implementations.

AFAIK, there's nowhere in Lucene that synchronizes on the Directory instance (where it matters), so multiple instances per path should be safe.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647109#action_12647109 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

bq.  if i'm reading it right, this patch won't work if two different callers ask for Directories backed by the same File using different directoryImpl instances ... the first one will go into the DIRECTORIES cache and "win" for all future calls.

Right... the tests in the patch test for this too.  If an instance already exists, then it's returned.  If all the instances are closed, the desired implementation can be returned.   So it won't be for all future calls, but it would be difficult to ensure you got the implementation you wanted.

bq. Hmm good point. Actually why do we do this 'single instance of FSDir per File' again? Is it really needed?

I had assumed it was locking.... but it goes outside of the FSDirectory and operates directly on File.  So, I'm not sure.



> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647651#action_12647651 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

I think File is fine?  But I don't have a strong preference (I can't think of any tradeoffs).

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647047#action_12647047 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

The actual class used for making new instances of Directory is FSDirectory.IMPL, set via the system property "org.apache.lucene.FSDirectory.class".

It seems like we should make it  possible to create multiple FSDirectory implementations of different types in the same JVM.
The simplest workaround would be to create a
  protected static FSDirectory getDirectory(File file, LockFactory lockFactory, Class impl)
Subclasses could implement their own getDirectory calls that pass down the appropriate class.

Not the most elegant solution if one were starting from scratch, but it seems like it would be completely backward compatible, while allowing NIOFSDirectory.getDirectory() to do what it looks like it should do.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647636#action_12647636 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

This looks good, Yonik.  Should we deprecate FSDirectory.getDirectory?

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647085#action_12647085 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

bq. 1. if i'm reading it right, this patch won't work if two different callers ask for Directories backed by the same File using different directoryImpl instances ... the first one will go into the DIRECTORIES cache and "win" for all future calls.

Hmm good point.  Actually why do we do this 'single instance of FSDir per File' again?  Is it really needed?

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated LUCENE-1451:
---------------------------------

    Attachment: LUCENE-1451.patch

Attaching patch with tests.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647086#action_12647086 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

bq. Hmmm, external subclasses should be able to call the protected getDirectory method, right?

Woops sorry you're right.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647065#action_12647065 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

Hmmm, external subclasses should be able to call the protected getDirectory method, right?
But perhaps a test case for external subclasses is warranted.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647061#action_12647061 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

That looks like a good approach to me.

Though, should we make the new getDirectory that takes the Class directoryImpl arg public, so that external subclasses of FSDirectory could also create their own instances?

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647129#action_12647129 ] 

Hoss Man commented on LUCENE-1451:
----------------------------------

bq. Right... the tests in the patch test for this too. If an instance already exists, then it's returned.

Miller is probably right and we should just remove the cache anyway -- but if we do leave it in this still seems dangerous to me, clients aren't guaranteed to get what they ask for.

Adopting the same pattern as with LockType (throw an Exception if a Directory is in the cache but doens't match the class specified) seems safer.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647249#action_12647249 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

I think we should simply allow direct instantiation of NIOFSDirectory, and not map to a singular instance per-File.  But we should keep it for FSDir for back-compat.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647645#action_12647645 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

Any preferences on the public constructor signature... File or String for the path?

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647642#action_12647642 ] 

Michael McCandless commented on LUCENE-1451:
--------------------------------------------

True.  And in general I don't like have more than one way to do basically the same thing.  People can always do the single-Directory-instance-per-File thing externally if they need to.

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley reassigned LUCENE-1451:
------------------------------------

    Assignee: Yonik Seeley

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1451) Can't create NIOFSDirectory w/o setting a system property

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647638#action_12647638 ] 

Yonik Seeley commented on LUCENE-1451:
--------------------------------------

bq. Should we deprecate FSDirectory.getDirectory? 

Perhaps... it would cut down the number of silly future errors in the form of NIOFSDirectory.getDirectory().

> Can't create NIOFSDirectory w/o setting a system property
> ---------------------------------------------------------
>
>                 Key: LUCENE-1451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1451
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Yonik Seeley
>            Assignee: Yonik Seeley
>            Priority: Minor
>         Attachments: LUCENE-1451.patch, LUCENE-1451.patch, LUCENE-1451.patch
>
>
> NIOFSDirectory.getDirectory() returns a FSDirectory object

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org