Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
9688eaf9
Commit
9688eaf9
authored
8 years ago
by
Roman Shevchenko
Browse files
Options
Download
Email Patches
Plain Diff
[platform] allows the IDE to shutdown gracefully when JNA isn't loaded (IDEA-159824)
parent
687d63de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
+2
-3
...form/platform-impl/src/com/intellij/idea/StartupUtil.java
platform/util/src/com/intellij/jna/JnaLoader.java
+35
-0
platform/util/src/com/intellij/jna/JnaLoader.java
platform/util/src/com/intellij/util/Restarter.java
+2
-1
platform/util/src/com/intellij/util/Restarter.java
with
39 additions
and
4 deletions
+39
-4
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
+
2
-
3
View file @
9688eaf9
...
...
@@ -19,6 +19,7 @@ import com.intellij.ide.customize.CustomizeIDEWizardDialog;
import
com.intellij.ide.customize.CustomizeIDEWizardStepsProvider
;
import
com.intellij.ide.plugins.PluginManagerCore
;
import
com.intellij.ide.startupWizard.StartupWizard
;
import
com.intellij.jna.JnaLoader
;
import
com.intellij.openapi.application.ApplicationInfo
;
import
com.intellij.openapi.application.ApplicationNamesInfo
;
import
com.intellij.openapi.application.ConfigImportHelper
;
...
...
@@ -37,7 +38,6 @@ import com.intellij.util.Consumer;
import
com.intellij.util.EnvironmentUtil
;
import
com.intellij.util.PlatformUtils
;
import
com.intellij.util.lang.UrlClassLoader
;
import
com.sun.jna.Native
;
import
org.apache.log4j.ConsoleAppender
;
import
org.apache.log4j.Level
;
import
org.apache.log4j.PatternLayout
;
...
...
@@ -340,8 +340,7 @@ public class StartupUtil {
System
.
setProperty
(
"jna.nosys"
,
"true"
);
// prefer bundled JNA dispatcher lib
}
try
{
long
t
=
System
.
currentTimeMillis
();
log
.
info
(
"JNA library loaded ("
+
(
Native
.
POINTER_SIZE
*
8
)
+
"-bit) in "
+
(
System
.
currentTimeMillis
()
-
t
)
+
" ms"
);
JnaLoader
.
load
(
log
);
}
catch
(
Throwable
t
)
{
logError
(
log
,
"Unable to load JNA library"
,
t
);
...
...
This diff is collapsed.
Click to expand it.
platform/util/src/com/intellij/jna/JnaLoader.java
0 → 100644
+
35
-
0
View file @
9688eaf9
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.intellij.jna
;
import
com.intellij.openapi.diagnostic.Logger
;
import
com.sun.jna.Native
;
public
class
JnaLoader
{
private
static
volatile
boolean
ourJnaLoaded
=
false
;
public
static
void
load
(
Logger
logger
)
{
long
t
=
System
.
currentTimeMillis
();
int
ptrSize
=
Native
.
POINTER_SIZE
;
t
=
System
.
currentTimeMillis
()
-
t
;
logger
.
info
(
"JNA library ("
+
(
ptrSize
<<
3
)
+
"-bit) loaded in "
+
t
+
" ms"
);
ourJnaLoaded
=
true
;
}
public
static
boolean
isLoaded
()
{
return
ourJnaLoaded
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
platform/util/src/com/intellij/util/Restarter.java
+
2
-
1
View file @
9688eaf9
...
...
@@ -15,6 +15,7 @@
*/
package
com.intellij.util
;
import
com.intellij.jna.JnaLoader
;
import
com.intellij.openapi.application.PathManager
;
import
com.intellij.openapi.util.SystemInfo
;
import
com.intellij.openapi.util.io.FileUtilRt
;
...
...
@@ -46,7 +47,7 @@ public class Restarter {
return
true
;
}
if
(
SystemInfo
.
isWindows
)
{
return
new
File
(
PathManager
.
getBinPath
(),
"restarter.exe"
).
exists
();
return
JnaLoader
.
isLoaded
()
&&
new
File
(
PathManager
.
getBinPath
(),
"restarter.exe"
).
exists
();
}
if
(
SystemInfo
.
isMac
)
{
return
PathManager
.
getHomePath
().
contains
(
".app"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment