JP2015075836A - Execution method of virtual machine, computer program and information processing apparatus - Google Patents
Execution method of virtual machine, computer program and information processing apparatus Download PDFInfo
- Publication number
- JP2015075836A JP2015075836A JP2013210409A JP2013210409A JP2015075836A JP 2015075836 A JP2015075836 A JP 2015075836A JP 2013210409 A JP2013210409 A JP 2013210409A JP 2013210409 A JP2013210409 A JP 2013210409A JP 2015075836 A JP2015075836 A JP 2015075836A
- Authority
- JP
- Japan
- Prior art keywords
- time
- virtual machine
- application
- system clock
- java
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Computer And Data Communications (AREA)
- Stored Programmes (AREA)
Abstract
Description
本発明は、オペレーティングシステム上の仮想マシンでアプリケーションを実行する情報処理装置における仮想マシンの実行方法、コンピュータプログラム及び情報処理装置に関する。 The present invention relates to a virtual machine execution method, a computer program, and an information processing apparatus in an information processing apparatus that executes an application in a virtual machine on an operating system.
近年、画像、音声、動画像等のマルチメディアデータを利用した拡張性の高いサービスを実現する手法として、サン・マイクロシステムズ社が提唱したオブジェクト指向型言語であるJava(登録商標)環境が普及している。 In recent years, the Java (registered trademark) environment, which is an object-oriented language proposed by Sun Microsystems, has become widespread as a method for realizing highly extensible services using multimedia data such as images, sounds, and moving images. ing.
Java環境では、Java言語で記述されたソースコードに基づく中間コードで構成されたJavaアプリからの要求に応じて、例えばインターネットなどの通信媒体を介して画像データがダウンロードされ、ダウンロードされた画像がJavaアプリで用いられる。 In the Java environment, image data is downloaded via a communication medium such as the Internet in response to a request from a Java application configured with an intermediate code based on a source code described in the Java language, and the downloaded image is downloaded to the Java environment. Used in apps.
Javaアプリは、1又は複数のプロセスとして並列的に実行されるようになっており、各プロセスで生成されて実行可能となったスレッドは、JavaVMによってCPU資源が割り当てられて実行される。例えば、特定のスレッドに所定時間だけ待機する処理要求が含まれていた場合、所定時間が経過すれば、その特定のスレッドが実行可能となる(特許文献1参照)。 The Java application is executed in parallel as one or a plurality of processes, and a thread generated and executable in each process is assigned with a CPU resource and executed by the Java VM. For example, when a processing request for waiting for a predetermined time is included in a specific thread, the specific thread can be executed when the predetermined time elapses (see Patent Document 1).
しかしながら、上述の特定のスレッドの待機中に、JavaVMが参照する時刻が変更されて変更直後に参照される時刻が変更直前に参照される時刻より前の時刻になった場合、待機の終了時刻の到来が遅れるために、そのスレッドが実行可能となるのを待ち受けている他のスレッドも待ち受け状態が継続されて、Javaアプリ全体が実質的に停止状態に陥ることがあった。 However, if the time referred to by the Java VM is changed while the specific thread is waiting, and the time referred to immediately after the change is earlier than the time referred to immediately before the change, the waiting end time Due to the delay in arrival, other threads waiting for the thread to become executable may continue to be in a standby state, and the entire Java application may be substantially stopped.
本発明は斯かる事情に鑑みてなされたものであり、その目的とするところは、仮想マシンが参照する時刻が変更された場合であっても、仮想マシン上で実行されるアプリケーションが実行停止状態に陥るのを防止することが可能な仮想マシンの実行方法、コンピュータプログラム及び情報処理装置を提供することにある。 The present invention has been made in view of such circumstances, and an object of the present invention is to stop execution of an application executed on a virtual machine even when the time referred to by the virtual machine is changed. An object of the present invention is to provide a virtual machine execution method, a computer program, and an information processing apparatus that can prevent the user from falling into a computer.
本発明に係る仮想マシンの実行方法は、時刻を計時するシステム時計を有するオペレーティングシステム上でアプリケーションを実行する仮想マシンを備え、前記アプリケーションに属するスレッドが、前記システム時計の時刻を基準とする時間に応じた処理の実行を前記仮想マシンに要求する情報処理装置における前記仮想マシンの実行方法において、前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行し、前記時刻設定アプリケーションが前記時刻を設定した場合、前記仮想マシンを再起動させることを特徴とする。 An execution method of a virtual machine according to the present invention includes a virtual machine that executes an application on an operating system having a system clock that measures time, and a thread belonging to the application has a time based on the time of the system clock. In the virtual machine execution method in the information processing apparatus that requests the virtual machine to execute a corresponding process, a time setting application for setting the time of the system clock is executed on the operating system, and the time setting application is When the time is set, the virtual machine is restarted.
本発明に係る仮想マシンの実行方法は、前記仮想マシンは、JavaVMであることを特徴とする。 The virtual machine execution method according to the present invention is characterized in that the virtual machine is a Java VM.
本発明に係る仮想マシンの実行方法は、前記処理は、Thread.sleepであることを特徴とする。 In the virtual machine execution method according to the present invention, the process is performed by thread. It is a sleep.
本発明に係る仮想マシンの実行方法は、前記情報処理装置をインターネットに接続するためのインタフェースを用意し、前記時刻設定アプリケーションは、前記時刻を前記インターネットに接続されたNTPサーバに同期させて設定することを特徴とする。 The virtual machine execution method according to the present invention provides an interface for connecting the information processing apparatus to the Internet, and the time setting application sets the time in synchronization with an NTP server connected to the Internet. It is characterized by that.
本発明に係る仮想マシンの実行方法は、前記情報処理装置をネットワークに接続するためのインタフェースを用意し、前記時刻設定アプリケーションは、前記インタフェースを介してウェブブラウザからアクセスされるウェブアプリケーションであり、該ウェブアプリケーションは、前記ウェブブラウザからの時刻の設定要求を受け付けて前記時刻を設定することを特徴とする。 The virtual machine execution method according to the present invention provides an interface for connecting the information processing apparatus to a network, and the time setting application is a web application accessed from a web browser via the interface, The web application receives the time setting request from the web browser and sets the time.
本発明に係る仮想マシンの実行方法は、前記仮想マシンが再起動した場合、前記ウェブアプリケーションは、前記ウェブブラウザに所定の情報を送信することを特徴とする。 The virtual machine execution method according to the present invention is characterized in that, when the virtual machine is restarted, the web application transmits predetermined information to the web browser.
本発明に係る仮想マシンの実行方法は、前記情報処理装置に光源を接続するためのインタフェースを用意し、前記光源の点灯を制御する光源制御アプリケーションを前記オペレーティングシステム上で実行し、前記仮想マシンが再起動した場合、前記光源制御アプリケーションは、前記光源を点灯又は点滅させることを特徴とする。 An execution method of a virtual machine according to the present invention provides an interface for connecting a light source to the information processing apparatus, executes a light source control application for controlling lighting of the light source on the operating system, and the virtual machine When restarting, the light source control application turns on or blinks the light source.
本発明に係るコンピュータプログラムは、時刻を計時するシステム時計を有するオペレーティングシステムを備えるコンピュータに、前記システム時計の時刻を基準とする時間に応じた処理の実行を要求するスレッドが属するアプリケーションを前記オペレーティングシステム上の仮想マシン上で実行させるコンピュータプログラムにおいて、コンピュータに、前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行させるステップと、前記時刻設定アプリケーションが前記時刻を設定した場合、コンピュータに、前記仮想マシンを再起動させるステップとを実行させることを特徴とする。 The computer program according to the present invention provides an operating system to which an application to which a thread that requests execution of processing according to time based on the time of the system clock belongs to a computer having an operating system having a system clock for measuring time. In the computer program to be executed on the upper virtual machine, the step of causing the computer to execute a time setting application for setting the time of the system clock on the operating system, and when the time setting application sets the time, the computer And a step of restarting the virtual machine.
本発明に係る情報処理装置は、時刻を計時するシステム時計を有するオペレーティングシステム上でアプリケーションを実行する仮想マシンを備え、前記アプリケーションに属するスレッドが、前記システム時計の時刻を基準とする時間に応じた処理の実行を前記仮想マシンに要求する情報処理装置において、前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行する手段と、前記時刻設定アプリケーションが前記時刻を設定した場合、前記仮想マシンを再起動させる手段とを備えることを特徴とする。 An information processing apparatus according to the present invention includes a virtual machine that executes an application on an operating system having a system clock that measures time, and a thread belonging to the application responds to a time based on the time of the system clock. In the information processing apparatus that requests the virtual machine to execute processing, a means for executing a time setting application for setting the time of the system clock on the operating system, and when the time setting application sets the time, Means for restarting the virtual machine.
本発明にあっては、時刻を計時するシステム時計を有するオペレーティングシステム上で動作する時刻設定アプリケーションが、システム時計の時刻を設定した場合、システム時計の時刻(即ち、システム時計が計時する時刻)を基準とする時間に応じた処理の実行を要求するスレッドが属するアプリケーションをオペレーティングシステム上で実行する仮想マシンを再起動させる。
つまり、仮想マシンがオペレーティングシステムを介してシステム時計の時刻を参照しており、仮想マシンがスレッドから要求された処理を実行する上で基準となる時刻が変更された場合に、仮想マシンが再起動してアプリケーションの実行が初期化される。
In the present invention, when a time setting application operating on an operating system having a system clock for measuring time sets the time of the system clock, the time of the system clock (that is, the time measured by the system clock) is set. A virtual machine that executes on the operating system an application to which a thread that requests execution of processing according to a reference time belongs is restarted.
In other words, if the virtual machine refers to the time of the system clock via the operating system and the virtual machine changes the reference time for executing the processing requested by the thread, the virtual machine is restarted Then, the execution of the application is initialized.
本発明にあっては、アプリケーションを実行する仮想マシンがJavaVMであり、システム時計の時刻が変更された場合であっても、JavaVMが実行するJavaアプリが実行停止状態となることが防止される。 In the present invention, even if the virtual machine that executes the application is the Java VM and the time of the system clock is changed, the Java application that is executed by the Java VM is prevented from being stopped.
本発明にあっては、システム時計の時刻を基準とする時間に応じた処理がThread.sleep関数であり、システム時計の時刻が設定されて変更された場合であっても、関数から要求された時間以上にスレッドの停止が長くなることが防止される。 In the present invention, the processing according to the time based on the time of the system clock is Thread. Even if it is a sleep function and the time of the system clock is set and changed, it is possible to prevent the thread from being stopped longer than the time requested by the function.
本発明にあっては、時刻設定アプリケーションにより、システム時計の時刻をインターネットに接続されたNTPサーバに同期させる。
これにより、システム時計の時刻がNTPサーバに同期したときに、JavaVMが再起動する。
In the present invention, the time of the system clock is synchronized with the NTP server connected to the Internet by the time setting application.
Thereby, when the time of the system clock is synchronized with the NTP server, the Java VM is restarted.
本発明にあっては、ネットワークに接続するためのインタフェースを介してウェブブラウザからアクセスされるウェブアプリケーションがウェブブラウザからの時刻の設定要求を受け付けて、システム時計の時刻を設定する。
これにより、システム時計の時刻が、ウェブブラウザからの要求によって設定されたときに、JavaVMが再起動する。
In the present invention, a web application accessed from a web browser via an interface for connecting to a network receives a time setting request from the web browser and sets the time of the system clock.
Thereby, when the time of the system clock is set by a request from the web browser, the Java VM is restarted.
本発明にあっては、仮想マシンが再起動した場合、前記ウェブアプリケーションが、自身にアクセスするウェブブラウザに所定の情報を送信する。
これにより、ウェブブラウザを操作する使用者に対して、仮想マシンが再起動した旨が報知される。
In the present invention, when the virtual machine is restarted, the web application transmits predetermined information to a web browser that accesses the virtual machine.
This notifies the user who operates the web browser that the virtual machine has been restarted.
本発明にあっては、仮想マシンが再起動した場合、オペレーティングシステム上で動作する光源制御アプリケーションによって、所定のインタフェースに接続された光源を点灯又は点滅させる。
これにより、光源の周囲に居る使用者に対して、仮想マシンが再起動した旨が報知される。
In the present invention, when the virtual machine is restarted, the light source connected to the predetermined interface is turned on or blinked by the light source control application operating on the operating system.
This notifies the user around the light source that the virtual machine has been restarted.
本発明によれば、仮想マシンがオペレーティングシステムを介してシステム時計の時刻を参照しており、仮想マシンがスレッドから要求された処理を実行する上で基準となる時刻が変更された場合に、仮想マシンが再起動してアプリケーションの実行が初期化される。
従って、仮想マシンが参照する時刻が変更された場合であっても、仮想マシン上で実行されるアプリケーションが実行停止状態に陥るのを防止することが可能となる。
According to the present invention, when the virtual machine refers to the time of the system clock via the operating system and the virtual machine changes the reference time for executing the processing requested by the thread, the virtual machine The machine restarts and application execution is initialized.
Therefore, even when the time referred to by the virtual machine is changed, it is possible to prevent the application executed on the virtual machine from entering an execution stop state.
以下、本発明をその実施の形態を示す図面に基づいて詳述する。
図1は、本発明に係る情報処理装置を備えるホームエネルギーマネジメントシステム(Home Energy Management System ;以下、HEMSという)の構成を示すブロック図である。図中1は情報処理装置であり、情報処理装置1は、NTP(Network Time Protocol )サーバ3が接続されたインターネット4に、ブロードバンドルータの機能を有するホームゲートウェイ5を介して接続される。ホームゲートウェイ5には、パーソナルコンピュータ(以下、PCという)2が接続されている。PC2は、例えばインターネット4に接続されるものであってもよいし、無線通信回線(不図示)を介して接続されるスマートフォン等の携帯電話であってもよい。
Hereinafter, the present invention will be described in detail with reference to the drawings illustrating embodiments thereof.
FIG. 1 is a block diagram showing a configuration of a home energy management system (Home Energy Management System; hereinafter referred to as HEMS) including an information processing apparatus according to the present invention. In the figure, reference numeral 1 denotes an information processing apparatus. The information processing apparatus 1 is connected to the Internet 4 to which an NTP (Network Time Protocol)
情報処理装置1には、後述するUSBインタフェース22,22によってUSB無線トランスミッタ/レシーバ(以下、USBT/Rと称し、図ではT/Rで示す)6,6が接続されている。USBT/R6,6の夫々と、分電盤7及び窓8に配されたセンサ9,9とは、無線による通信が可能に構成されている。分電盤7に配されたセンサ9は、家庭の使用電力を検出したり、電力回路を開閉したりするものである。また、窓8に配されたセンサ9は、窓8の周囲の明るさを検出したり、室内への人の侵入を検出したりするものである。
Connected to the information processing apparatus 1 are USB wireless transmitter / receivers (hereinafter referred to as USB T / R, indicated by T / R in the figure) 6 and 6 by
上述したHEMSの構成において、情報処理装置1は、USBT/R6,6によってセンサ9,9の夫々から電力データ及び照度データを収集して使用電力量の集計を行うと共に、図示しない室内照明の輝度を照度データに応じて制御する。情報処理装置1は、また、ホームサーバの機能を備えており、例えば、PC2に搭載されたブラウザからアクセスされた場合、アクセス元のブラウザに家庭の使用電力量のグラフを表示させたり、ブラウザからの制御によって室内の電気製品の電源をオンオフさせたりすることができる。更に、窓8から人が侵入した場合、図示しない携帯電話に発報することもできる。
In the HEMS configuration described above, the information processing apparatus 1 collects power data and illuminance data from the sensors 9 and 9 by the USBT / Rs 6 and 6 and totals the amount of power used. Is controlled according to the illuminance data. The information processing apparatus 1 also has a home server function. For example, when accessed from a browser installed in the PC 2, the home power consumption graph is displayed on the browser of the access source, or from the browser. The power of indoor electric products can be turned on and off by the control. Further, when a person enters through the
次に、情報処理装置1の主要部の構成及び機能について説明する。
図2は、情報処理装置1の構成を示すブロック図である。情報処理装置1は、ソフトウェア(以下、S/Wという)による機能ブロックを実現するCPU10と、該CPU10の周辺ハードウェア(以下、H/Wという)20とを備える。
Next, the configuration and function of the main part of the information processing apparatus 1 will be described.
FIG. 2 is a block diagram illustrating a configuration of the information processing apparatus 1. The information processing apparatus 1 includes a
S/Wによる機能ブロックは、Linux(登録商標)等のオペレーティングシステム(Operating System ;以下、OSという)11と、Javaアプリ12を実行する仮想マシンとしてのJavaVM(Java Virtual Machine )13と、サーバS/Wであるウェブサーバ(以下、Webサーバという)14と、NTPサーバ3に時刻同期するための時刻同期アプリケーション(以下、時刻同期アプリという)15と、後述するLED23の点消灯を制御するLED制御アプリケーション(光源制御アプリケーション;以下、LED制御アプリという)16とを含んで構成されている。
The functional blocks based on S / W include an operating system (hereinafter referred to as OS) 11 such as Linux (registered trademark), a Java VM (Java Virtual Machine) 13 as a virtual machine that executes the
OS11は、Linuxに限定されず、Windows(登録商標)等の他のOSであってもよい。仮想マシンはJavaVM13に限定されず、例えばマイクロソフト社によるドットネットフレームワーク(.Net Framework )等の他の仮想マシンであってもよい。
The
JavaVM13及びLED制御アプリ16は、CPU10が実行するOS11上で動作する。Webサーバ14及び時刻同期アプリ15は、後述するシステム時計111の時刻を設定する時刻設定アプリケーションとして、CPU10が実行するOS11上で動作する。
The
周辺H/W20は、ホームゲートウェイ5に接続するためのイーサネットインタフェース(インターネット又はネットワークに接続するためのインタフェース;以下、イーサネットI/Fという;イーサネットは登録商標)21と、USBT/R6,6に接続するためのUSBインタフェース(以下、USBI/Fという)22,22と、使用者に所定の報知を行うためのLED(光源を接続するためのインタフェースを含む光源)23とを含んで構成されている。LED23は、周辺H/Wから信号ケーブルを介して外部に接続されていてもよい。イーサネットI/F21、USBI/F22,22及びLED23は、OS11に組み込まれた夫々のデバイスドライバを介してOS11から操作される。
The peripheral H /
OS11は、周辺H/W20に含まれる図示しないリアルタイムクロックから起動時に取得した時刻情報に基づいて時刻を計時するシステム時計111と、OS11上で動作する各アプリケーションの起動、停止、再起動等を管理するアプリケーション管理部112とを含んでなる。各アプリケーションによるシステム時計111からの時刻の読み出しは、OS11に対するシステムコールによって行う。即ち、OS11は、時刻情報を取得するシステムコールがあった場合、システム時計111が計時する時刻を読み出してシステムコールのリターン値に設定する。
The
Javaアプリ12は、上述したHEMSのホームサーバの機能を実現するものであり、USBT/R6,6及びUSBI/F22,22を介してセンサ9,9と通信すると共に、ホームゲートウェイ5を介してPC2と通信する。Javaアプリ12は、Java言語で記述されたソースコードに基づく中間コードで構成されたアプリケーションである。
The
図3は、Javaアプリ12に属するスレッドのソースコードの例示図である。Java言語で記述されたソースコードは、予めコンパイルされ、中間コードに変換されて実機に実装される。図中Thread.sleep(5000)は、スリープ関数である。スリープ関数は、「システム時計111の時刻を基準とする時間に応じた処理の実行をJavaVM13に要求する」関数の1つである。Thread.sleep(5000)は、この関数をコールしたスレッドを5000ms間停止(以下、スリープという)させることを要求するものである。
FIG. 3 is an exemplary diagram of source code of threads belonging to the
「システム時計111の時刻を基準とする時間に応じた処理の実行をJavaVM13に要求する」関数は、Thread.sleep()に限定されるものではなく、例えばThread.join()、Object.wait()等のタイムアウトのパラメータを伴う他の関数であってもよい。
The “
図2に戻って、JavaVM13は、Javaアプリ12を構成する中間コードを逐次解釈し、CPU10が実行可能な機械語に変換して実行する。JavaVM13のこの機能によって、特定のOSやプロセッサに依存することなく、いかなるプラットフォームであってもJavaアプリ12が実行可能な環境が実現される。
Returning to FIG. 2, the
JavaVM13は、Javaアプリ12からシステム時計111の時刻を基準とする時間に応じた処理の実行を要求された場合に、要求された処理の実行に係る時刻を記憶するための時刻情報記憶部131を含んでなる。例えばThread.sleep(t)がコールされた場合、JavaVM13は、システム時計111から時刻を読み出し、読み出した時刻に時間t(ms)を加算した時刻を時刻情報記憶部131に記憶し、記憶した時刻が到来した時に、Thread.sleep(t)をコールしたスレッドの実行を再開する。
When the
Webサーバ14は、時刻設定等のWebユーザインタフェース画面を提供するプログラムが組み込まれたWebアプリケーションであり、PC2とホームゲートウェイ5及びイーサネットI/F21を介して通信する。時刻設定のプログラムは、PC2に搭載されたブラウザからのWebサーバ14へのアクセスに伴って起動され、Webサーバ14と一体となって動作する。Webサーバ14は、ブラウザから時刻の設定要求を受信してシステム時計111に時刻を設定した場合、アプリケーション管理部112にJavaVM13の再起動を要求する。
The
時刻同期アプリ15は、設定された時刻が到来した時に、インターネット4に接続されたNTPサーバ3と、ホームゲートウェイ5及びイーサネットI/F21を介して通信し、NTPプロトコル又はSNTPプロトコルを実行してシステム時計111の時刻をNTPサーバ3の時刻に同期させた場合、アプリケーション管理部112にJavaVM13の再起動を要求する。
When the set time arrives, the
ここで、Webサーバ14がシステム時計に時刻を設定したり、時刻同期アプリ15がシステム時計111の時刻をNPTサーバ3の時刻に同期させたりすることによって、システム時計111の時刻が該システム時計111に対する時刻の設定又は同期が行われる直前に参照される時刻より前の時刻に変更された時に、たまたまスレッドがThread.sleep(t)をコールしてスリープ中であった場合、システム時計111の時刻が過去に遡った分だけスレッドのスリープ時間が延長されることとなる。つまり、システム時計111の時刻が変更前の時刻に追いつくまで、スリープ中のスレッドを含むJavaアプリ12が、見かけ上全く動作できない状態が長時間続く可能性がある。
Here, when the
これとは逆にシステム時計111の時刻が該システム時計111に対する時刻の設定又は同期が行われる直前に参照される時刻より先の時刻に変更された場合は、システム時計111の時刻が進んだ分だけスレッドのスリープ時間が短縮されることとなり、スレッドの動作が不自然になる。一方、Webサーバ14によってシステム時計111の時刻が変更されて変更直後に参照される時刻が変更直前に参照される時刻より先の時刻になった後に、時刻同期アプリ15によってシステム時計111の時刻が正しく修正された場合は、結果的にシステム時計111の時刻が過去に引き戻される。よってこの場合にも、Webサーバ14によってシステム時計111の時刻が変更されて変更直後に参照される時刻が変更直前に参照される時刻より前の時刻に変更された場合と同じ問題が発生する。
On the contrary, when the time of the
そこで、本発明では、システム時計111の時刻が変更された場合に、JavaVM13の再起動が要求される。より好ましくは、Webサーバ14によってシステム時計111の時刻が設定されて設定直後に参照される時刻が設定直前に参照される時刻より前の時刻になった場合、及び過去の時刻を計時しているシステム時計111が時刻同期アプリ15によってNTPサーバ3に時刻同期した場合、JavaVM13の再起動が要求されるようにする。
Therefore, in the present invention, when the time of the
アプリケーション管理部112は、Webサーバ14又は時刻同期アプリ15からJavaVM13の再起動を要求された場合、JavaVM13を再起動させると共に、その旨をWebサーバ14及びLED制御アプリ16に通知する。
When the restart of the
LED制御アプリ16は、JavaVM13が再起動した旨が通知された場合、LED23を点滅させる。この場合、LED23が任意の点灯パターンで点灯するようにしてもよい。
When notified that the
以下では、上述したS/Wの機能ブロックの動作を、それを示すフローチャートを用いて説明する。以下に示す処理は、周辺H/W20に含まれる図示しないROMに予め格納されている制御プログラムに従って、CPU10により実行される。以下に示す処理で授受される情報又は信号は、図2にて矢印付き実線で示されるものである。
Hereinafter, the operation of the above-described S / W functional block will be described with reference to a flowchart showing the operation. The processing shown below is executed by the
先ず、Webサーバ14が介在してシステム時計111の時刻が設定される場合について説明する。
図4は、Webサーバ14によってシステム時計111の時刻を設定するCPU10の処理手順を示すフローチャートである。図4の処理は、外部のブラウザからのアクセスが可能になった場合に適時起動される。ここでは、簡単のために、Webサーバ14が時刻設定画面へのアクセスのみを受け付けるものとする。
First, a case where the time of the
FIG. 4 is a flowchart showing a processing procedure of the
図4の処理が起動された場合、CPU10は、例えばHTTPリクエスト等によるWebサーバ14へのアクセスが有ったか否かを判定し(S10)、アクセスが有るまで待機する(S10:NO)。アクセスが有った場合(S10:YES)、CPU10は、HTTPリクエスト等に含まれるURLが、時刻設定画面へのアクセスを示すものであるか否かを判定し(S11)、時刻設定画面へのアクセスを示すものではない場合(S11:NO)、処理をステップS10に移してWebサーバへのアクセスを待ち受ける。
When the process of FIG. 4 is started, the
URLが時刻設定画面へのアクセスを示すものである場合(S11:YES)、CPU10は、システム時計111の時刻を読み出し(S12)、読み出した時刻が表示された時刻設定画面(Webユーザインタフェース画面)を生成し(S13)、生成した画面の画面データをアクセス元のブラウザに送信する(S14)。
When the URL indicates access to the time setting screen (S11: YES), the
その後、CPU10は、アクセス元のブラウザから時刻の設定要求を受信したか否かを判定し(S15)、時刻の設定要求を受信するまで待機する(S15:NO)。時刻の設定要求を受信した場合(S15:YES)、CPU10は、システム時計111に対して時刻の設定要求に含まれる時刻を設定し(S16)、更にアプリケーション管理部112に対してJavaVM13の再起動を要求する(S17)。
Thereafter, the
ステップS16では、システム時計111の時刻が設定されて設定直後に参照される時刻が設定直前に参照される時刻より前の時刻になった場合にステップS17の処理に移るようにし、そうでない場合に図4の処理を終了することが好ましい。これにより、スリープ中のスレッドを含むJavaアプリ12が見かけ上全く動作できない状態が、長時間続くのを効果的に防止することができる。
In step S16, when the time of the
その後、CPU10は、アプリケーション管理部112からJavaVM13の再起動通知が有ったか否かを判定し(S18)、再起動通知が有るまで待機する(S18:NO)。JavaVM13の再起動通知が有った場合(S18:YES)、CPU10は、アクセス元のブラウザに提供している時刻設定画面上に、例えばポップアップで表示される再起動の報知画面を生成し(S19)、生成した画面の画面データをアクセス元のブラウザに送信して(S20)図4の処理を終了する。
Thereafter, the
次に、時刻同期アプリ15が介在してシステム時計111の時刻が設定される場合について説明する。
図5は、時刻同期アプリ15によってシステム時計111の時刻を設定するCPU10の処理手順を示すフローチャートである。図5の処理は、例えば1秒毎に起動されるが、これに限定されるものではない。NTPサーバ3に同期すべき時刻(より具体的には、時刻同期処理を実行すべき時刻)は、周辺H/W20に含まれる図示しないRAMに設定されているものとする。
Next, a case where the time of the
FIG. 5 is a flowchart showing a processing procedure of the
図5の処理が起動された場合、CPU10は、システム時計111の時刻を読み出し(S21)、読み出した時刻によって、RAMに設定されているNTPサーバ3に同期すべき時刻が到来したか否かを判定し(S22)、その時刻が到来していない場合(S22:NO)、その他の処理を行わずに図5の処理を終了する。
When the process of FIG. 5 is activated, the
NTPサーバ3に同期すべき時刻が到来した場合(S22:YES)、CPU10は、NTPプロトコル(又はSNTPプロトコル)を実行して(S23)時刻合わせを行うことにより、システム時計111に対して時刻を設定し(S24)、更にアプリケーション管理部112に対してJavaVM13の再起動を要求して(S25)図5の処理を終了する。
When the time to synchronize with the
ステップS24では、システム時計111の時刻が設定されて設定直後に参照される時刻が設定直前に参照される時刻より前の時刻になった場合にステップS25の処理に移るようにし、そうでない場合に図5の処理を終了することが好ましい。これにより、スリープ中のスレッドを含むJavaアプリ12が見かけ上全く動作できない状態が、長時間続くのを効果的に防止することができる。
In step S24, when the time of the
次に、JavaVM13を再起動させる処理について説明する。
図6は、アプリケーション管理部112によってJavaVM13を再起動させるCPU10の処理手順を示すフローチャートである。図6の処理は、JavaVM13が最初に起動された後、適時起動される。
Next, processing for restarting the
FIG. 6 is a flowchart showing a processing procedure of the
図6の処理が起動された場合、CPU10は、JavaVM13を再起動させる要求が有ったか否かを判定し(S31)、再起動の要求が有るまで待機する(S31:NO)。JavaVM13を再起動させる要求があった場合(S31:YES)、CPU10は、JavaVM13を再起動させる(S32;図2では矢印付きの破線で示す)。
When the processing of FIG. 6 is activated, the
次いで、CPU10は、LED制御アプリ16に対してJavaVM13の再起動を通知する(S33)と共に、Webサーバ14に対してJavaVM13の再起動を通知して(S34)図6の処理を終了する。
Next, the
最後に、LED23を点滅させる処理について説明する。
図7は、LED制御アプリ16によってLED23を点滅させるCPU10の処理手順を示すフローチャートである。図7の処理は、JavaVM13が起動しており、LED23が消灯している状態で適時起動される。
Finally, a process for blinking the
FIG. 7 is a flowchart showing a processing procedure of the
図7の処理が起動された場合、CPU10は、アプリケーション管理部112からJavaVM13の再起動通知が有ったか否かを判定し(S41)、再起動通知が有るまで待機する(S41:NO)。JavaVM13の再起動通知が有った場合(S41:YES)、CPU10は、LED23を点滅させて(S42)図7の処理を終了する。
When the process of FIG. 7 is started, the
以上のように本実施の形態によれば、時刻を計時するシステム時計111を有するオペレーティングシステム11上で動作する時刻設定アプリケーションが、システム時計111に時刻を設定した場合、システム時計111の時刻を基準とする時間に応じた処理(Thread.sleep)の実行を要求するスレッドが属するアプリケーション(Javaアプリ12)をオペレーティングシステム11上で実行する仮想マシン(JavaVM13)を再起動させる。
つまり、JavaVM13がオペレーティングシステム11を介してシステム時計111の時刻を参照しており、JavaVM13がスレッドから要求された処理を実行する上で基準となる時刻が変更された場合に、JavaVM13が再起動してJavaアプリ12の実行が初期化される。
従って、仮想マシンが参照する時刻が変更された場合であっても、仮想マシン上で実行されるアプリケーションが実行停止状態に陥るのを防止することが可能となる。
As described above, according to the present embodiment, when a time setting application operating on the
In other words, when the
Therefore, even when the time referred to by the virtual machine is changed, it is possible to prevent the application executed on the virtual machine from entering an execution stop state.
また、アプリケーションを実行する仮想マシンがJavaVM13であり、システム時計111の時刻が変更された場合であっても、JavaVM13が実行するJavaアプリ12が実行停止状態となることを防止することが可能となる。
Further, even when the virtual machine that executes the application is the
更に、システム時計111の時刻を基準とする時間に応じた処理がThread.sleep関数であり、システム時計111の時刻が設定されて変更された場合であっても、この関数から要求された時間以上にスレッドの停止が長くなるのを防止することが可能となる。
Further, processing according to the time based on the time of the
更にまた、時刻設定アプリケーション(時刻同期アプリ15)により、システム時計111の時刻をインターネット4に接続されたNTPサーバ3に同期させる。
従って、システム時計111の時刻がNTPサーバ3に同期したときに、JavaVM13を再起動させることが可能となる。
Furthermore, the time of the
Accordingly, the
更にまた、ネットワークに接続するためのイーサネットインタフェース21を介してPC2のWebブラウザからアクセスされるWebアプリケーション(Webサーバ14)がWebブラウザからの時刻の設定要求を受け付けて、システム時計111の時刻を設定する。
従って、システム時計111の時刻が、Webブラウザからの要求によって設定されたときに、JavaVM13を再起動させることが可能となる。
Furthermore, the Web application (Web server 14) accessed from the Web browser of the
Therefore, the
更にまた、仮想マシン(JavaVM13)が再起動した場合、前記Webアプリケーション(Webサーバ14)が、自身にアクセスするWebブラウザに所定の情報(再起動の報知画面の画面データ)を送信する。
これにより、Webブラウザを操作する使用者に対して、仮想マシンが再起動した旨を報知することが可能となる。
Furthermore, when the virtual machine (Java VM 13) is restarted, the Web application (Web server 14) transmits predetermined information (screen data of a restart notification screen) to the Web browser accessing itself.
Thereby, it is possible to notify the user who operates the Web browser that the virtual machine has been restarted.
更にまた、仮想マシン(JavaVM13)が再起動した場合、オペレーティングシステム11上で動作する光源制御アプリケーション(LED制御アプリ16)によって、所定のインタフェースに接続された光源(LED23)を点灯又は点滅させる。
従って、LED23の周囲に居る使用者に対して、仮想マシンが再起動した旨を報知することが可能となる。
Furthermore, when the virtual machine (Java VM 13) is restarted, the light source (LED 23) connected to a predetermined interface is turned on or blinked by the light source control application (LED control application 16) operating on the
Therefore, it is possible to notify the users around the
今回開示された実施の形態は、全ての点で例示であって、制限的なものではないと考えられるべきである。本発明の範囲は、上述した意味ではなく、特許請求の範囲によって示され、特許請求の範囲と均等の意味及び範囲内での全ての変更が含まれることが意図される。 The embodiment disclosed this time is to be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the meanings described above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.
1 情報処理装置
10 CPU
11 OS(オペレーティングシステム)
12 Javaアプリ(アプリケーション)
13 JavaVM(仮想マシン)
14 Webサーバ(Webアプリケーション)
15 時刻同期アプリ(時刻設定アプリケーション)
16 LED制御アプリ
21 イーサネットI/F(インターネットに接続するためのインタフェース、ネットワークに接続するためのインタフェース)
23 LED(光源)
2 PC
3 NTPサーバ
4 インターネット
5 ホームゲートウェイ
1
11 OS (Operating System)
12 Java application (application)
13 JavaVM (virtual machine)
14 Web server (Web application)
15 Time synchronization application (time setting application)
16 LED control application 21 Ethernet I / F (interface for connecting to the Internet, interface for connecting to the network)
23 LED (light source)
2 PC
3 NTP server 4
Claims (9)
前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行し、
前記時刻設定アプリケーションが前記時刻を設定した場合、前記仮想マシンを再起動させること
を特徴とする仮想マシンの実行方法。 A virtual machine that executes an application on an operating system having a system clock that measures the time is provided, and a thread belonging to the application requests the virtual machine to execute a process according to a time based on the time of the system clock. In the method of executing the virtual machine in the information processing apparatus,
A time setting application for setting the time of the system clock is executed on the operating system;
The virtual machine execution method, wherein when the time setting application sets the time, the virtual machine is restarted.
前記時刻設定アプリケーションは、前記時刻を前記インターネットに接続されたNTPサーバに同期させて設定することを特徴とする請求項1から3の何れか1項に記載の仮想マシンの実行方法。 Providing an interface for connecting the information processing apparatus to the Internet;
4. The virtual machine execution method according to claim 1, wherein the time setting application sets the time in synchronization with an NTP server connected to the Internet. 5.
前記時刻設定アプリケーションは、前記インタフェースを介してウェブブラウザからアクセスされるウェブアプリケーションであり、
該ウェブアプリケーションは、前記ウェブブラウザからの時刻の設定要求を受け付けて前記時刻を設定すること
を特徴とする請求項1から3の何れか1項に記載の仮想マシンの実行方法。 Preparing an interface for connecting the information processing apparatus to a network;
The time setting application is a web application accessed from a web browser through the interface,
4. The virtual machine execution method according to claim 1, wherein the web application receives a time setting request from the web browser and sets the time. 5.
前記光源の点灯を制御する光源制御アプリケーションを前記オペレーティングシステム上で実行し、
前記仮想マシンが再起動した場合、前記光源制御アプリケーションは、前記光源を点灯又は点滅させること
を特徴とする請求項1から6の何れか1項に記載の仮想マシンの実行方法。 Preparing an interface for connecting a light source to the information processing apparatus;
A light source control application for controlling lighting of the light source is executed on the operating system;
The virtual machine execution method according to any one of claims 1 to 6, wherein when the virtual machine is restarted, the light source control application turns on or blinks the light source.
コンピュータに、前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行させるステップと、
前記時刻設定アプリケーションが前記時刻を設定した場合、コンピュータに、前記仮想マシンを再起動させるステップと
を実行させることを特徴とするコンピュータプログラム。 A computer having an operating system having a system clock for measuring time is caused to execute on a virtual machine on the operating system an application to which a thread that requests execution of processing according to time based on the time of the system clock belongs. In a computer program,
Causing the computer to execute a time setting application for setting the time of the system clock on the operating system;
A computer program for causing a computer to restart the virtual machine when the time setting application sets the time.
前記システム時計の時刻を設定する時刻設定アプリケーションを前記オペレーティングシステム上で実行する手段と、
前記時刻設定アプリケーションが前記時刻を設定した場合、前記仮想マシンを再起動させる手段とを備えること
を特徴とする情報処理装置。 A virtual machine that executes an application on an operating system having a system clock that measures the time is provided, and a thread belonging to the application requests the virtual machine to execute a process according to a time based on the time of the system clock. In the information processing apparatus to
Means for executing a time setting application for setting the time of the system clock on the operating system;
An information processing apparatus comprising: means for restarting the virtual machine when the time setting application sets the time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013210409A JP6149671B2 (en) | 2013-10-07 | 2013-10-07 | Virtual machine execution method, computer program, and information processing apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013210409A JP6149671B2 (en) | 2013-10-07 | 2013-10-07 | Virtual machine execution method, computer program, and information processing apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015075836A true JP2015075836A (en) | 2015-04-20 |
JP6149671B2 JP6149671B2 (en) | 2017-06-21 |
Family
ID=53000671
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013210409A Active JP6149671B2 (en) | 2013-10-07 | 2013-10-07 | Virtual machine execution method, computer program, and information processing apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6149671B2 (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006021489A (en) * | 2004-07-09 | 2006-01-26 | Canon Inc | Printer, control method, program, and storage medium |
JP2006146678A (en) * | 2004-11-22 | 2006-06-08 | Hitachi Ltd | Method for controlling program in information processor, information processor and program |
JP2011198013A (en) * | 2010-03-19 | 2011-10-06 | Fujitsu Ltd | Information processor and method of starting information processor |
JP2012027768A (en) * | 2010-07-26 | 2012-02-09 | Ricoh Co Ltd | Embedded device, method for setting parameters, computer program, and recording medium |
JP2012073143A (en) * | 2010-09-29 | 2012-04-12 | Mitsubishi Electric Corp | Information processor |
JP2012190319A (en) * | 2011-03-11 | 2012-10-04 | Fujitsu Ltd | Information processing apparatus and time control method |
-
2013
- 2013-10-07 JP JP2013210409A patent/JP6149671B2/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006021489A (en) * | 2004-07-09 | 2006-01-26 | Canon Inc | Printer, control method, program, and storage medium |
JP2006146678A (en) * | 2004-11-22 | 2006-06-08 | Hitachi Ltd | Method for controlling program in information processor, information processor and program |
JP2011198013A (en) * | 2010-03-19 | 2011-10-06 | Fujitsu Ltd | Information processor and method of starting information processor |
JP2012027768A (en) * | 2010-07-26 | 2012-02-09 | Ricoh Co Ltd | Embedded device, method for setting parameters, computer program, and recording medium |
JP2012073143A (en) * | 2010-09-29 | 2012-04-12 | Mitsubishi Electric Corp | Information processor |
JP2012190319A (en) * | 2011-03-11 | 2012-10-04 | Fujitsu Ltd | Information processing apparatus and time control method |
Also Published As
Publication number | Publication date |
---|---|
JP6149671B2 (en) | 2017-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105426141B (en) | Information processing method and electronic device supporting the same | |
US20200034725A1 (en) | Methods and system for managing predictive models | |
KR102137097B1 (en) | Processing Method for periodic event and Electronic device supporting the same | |
RU2012128113A (en) | CONTROL DEVICE FOR CHANGING IMAGES ON A SMARTPHONE DISPLAY | |
TWI573075B (en) | Persistent and resilient worker processes | |
JP2014131108A5 (en) | ||
US20200174823A1 (en) | State management method and apparatus for virtual machine, and smart terminal thereof | |
KR102222337B1 (en) | Apparatus and method for synchronizing among applications | |
TW201033832A (en) | Programming model for synchronizing browser caches across devices and web services | |
JP2011134018A5 (en) | Image processing system, web server, image processing method, web server control method, and program | |
WO2019154241A1 (en) | Power consumption control method and camera device | |
EP2985675B1 (en) | Method of controlling an electronic device according to a communication state of the electronic device | |
US11595889B2 (en) | Determining a duty schedule for a group of lighting devices providing a similar lighting service | |
KR102358002B1 (en) | Contents transmission controlling method and electronic device supporting the same | |
WO2015172283A1 (en) | Method, device and mobile terminal for reducing power consumption | |
JP6088531B2 (en) | Event service for local client applications through a local server | |
JP6149671B2 (en) | Virtual machine execution method, computer program, and information processing apparatus | |
WO2016008256A1 (en) | Method for terminal to update operating system, terminal and system | |
EP3054709B1 (en) | Electronic apparatus and short-range communication method thereof | |
CN116610508A (en) | Heat dissipation test method and device, electronic equipment and storage medium | |
CN112839065A (en) | Information processing method and device, first equipment and storage medium | |
WO2022089216A1 (en) | Interface display method and electronic device | |
KR102303707B1 (en) | Electronic device and operation method of thereof | |
CN115987786A (en) | Configuration change method, system, terminal equipment and storage medium | |
JP6515052B2 (en) | Communication apparatus, communication system, communication method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A711 Effective date: 20160629 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20160629 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20160719 |
|
TRDD | Decision of grant or rejection written | ||
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20170419 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20170425 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20170508 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6149671 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |