Skip to Main Content

Java HotSpot Virtual Machine

Announcement

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

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

Creating a new local ref from a weak ref because you need to call a method

843829Sep 9 2010 — edited Sep 11 2010
Hi,

I was looking at some jni code & I dont understand why you need to create a local reference from a weak one to call methods on it?

Heres the snippet:

if(NULL!=(local_ref = ((l_env.THIS))->NewLocalRef((l_env.THIS), weakRefListener)))*
*{*
l_class = ((l_env.THIS))->GetObjectClass((l_env.THIS), local_ref);*
if (l_class == ((l_env.THIS))->FindClass((l_env.THIS), "java/lang/ref/WeakReference"))*
*{*
if(NULL!=(methodID = ((l_env.THIS))->GetMethodID((l_env.THIS), l_class, (char*)"get", (char*)"()Ljava/lang/Object;")))*
*{*
strongRefListener = ((l_env.THIS))->CallObjectMethod((l_env.THIS), local_ref, methodID);*
*(*(l_env.THIS))->DeleteLocalRef((l_env.THIS), local_ref);*
*}*
*}*
else
*{*
strongRefListener = local_ref;
*}*

if (strongRefListener == NULL)
*{*
printf("failed to create strong reference");
*}*
else
*{*
*//* Call Java method *
*...... more code ..........*
*}*

Again I can't find any info as to why I need a strong reference or as to why I need to call a method "get" on it if its a weak reference. Does a weak reference get 'woken up' when invoked?


Thanks for reading this. I hope you understand it better than me.
Ryan

Edited by: mcCuppaT on Sep 9, 2010 3:35 AM

Edited by: mcCuppaT on Sep 9, 2010 3:35 AM

Comments

Glen Conway

Presumably the Query Results tab in 3.2 did not have a problem when you originally installed it. Possibly the loss of highlighting and context menu is due to corruption of user settings.  And if you migrated any corrupt settings to newer versions, that could be the problem with whatever 18.x version you have.  Otherwise you might suspect a mismatch between the versions of SQL Developer, Java, and some native driver on the OS.

Assuming Windows, exit and restart SQL Developer after renaming the system<yourSqlDevVersion> folder to something else in C:\Users\<yourUserID>\AppData\Roaming\SQL Developer.  That will create a fresh user settings folder, either with default values or values migrated from some earlier version, depending on your choice.

Final advice:  don't use extremely old versions of software unless you have a really good reason.

Cheers

User_EKWC5

Thanks Glen for the reply

I was using the version 3.2.09  earlier, and faced issue their, so upgraded to Version 18.4.0.376, Build 376.1900 which resolved the issue for few months. But again suddenly started facing the same problem V18 as well.

So uninstalled V18 and was trying to check if V3 has the issue or not by reinstalling V3.

I am using Windows. I tried to rename the directory as suggested by you, and started SQL Developer, but no luck.

I have already tried uninstalling V3 and reinstalling SQL developer V18 and renaming the directories in AppData\Roaming\SQL Developer but no luck.

Currently i have V18 installed on my machine.

Any other option you think?

Glen Conway
Answer

It is not clear to me whether your efforts at reinstalling V3 / V18 included migrating settings from a prior version or using fresh default settings.

Whenever there are issues with a new version with migrated settings, I always Export Connections from the prior version's Connections navigator tree, delete the user settings folder for the new version, then start up the new version, avoid migrating settings, and Import Connections from the prior version.

If that's not what you've already done, then try that, or even get the latest 19.4 and avoid migrating settings.

Another possibility could be (from the SQL Developer main toolbar) using Window > Reset WIndows To Factory Setting.

Good luck

Marked as Answer by User_EKWC5 · Sep 27 2020
User_EKWC5

Hey Glen,

I have tried to uninstall V18, removing AppData\Raoming\SQL Developer .. files and with both options i.e. importing the settings from previous version and using fresh default settings, but no luck .

Also i already tried the Factory reset option in past and also today i tried it but that also does not work.

I am trying with V1.5 now as thats the version where i can see the query results pane is accessible and i can copy something from there.

Thanks,

Glen Conway

Wow, V1.5, that really is a piece of history! The suggestion to use fresh, default user settings really should have worked. Just out of curiosity, what is your OS and OS version?

User_EKWC5

I installed V19 as you suggested, i did not import the settings from previous installations and that resolved the problem. Thanks.

By the way i am using Windows 10, 64 bit OS.

Glen Conway

Wonderful!  Really glad to know you are not mysteriously being blocked from using the latest / greatest SQL Developer.

Edit:  If the problem eventually comes back, that may suggest you have a pattern of use that leads to corruption of the user settings.  But hopefully not.

User_EKWC5

How can i mark this thread as Answered?

Glen Conway

You cannot do it from the Inbox, you actually have to open the thread:  See:

1 - 9
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 9 2010
Added on Sep 9 2010
4 comments
254 views